How can I make a bash command run periodically?

If you want to run a command periodically, there’s 3 ways :

  • using the crontab command ex. * * * * * command (run every minutes)
  • using a loop like : while true; do ./my_script.sh; sleep 60; done (not precise)
  • using systemd timer

See cron

Some pointers for best bash scripting practices :

http://mywiki.wooledge.org/BashFAQ
Guide: http://mywiki.wooledge.org/BashGuide
ref: http://www.gnu.org/software/bash/manual/bash.html
http://wiki.bash-hackers.org/
USE MORE QUOTES!: http://www.grymoire.com/Unix/Quote.html
Scripts and more: http://www.shelldorado.com/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)