Ubuntu – How to run cron job every 2 hours

cronUbuntu

How can I write a Crontab that will run my /home/username/test.sh script every 2 hours?

Best Answer

Just do:

0 */2 * * *  /home/username/test.sh 

The 0 at the beginning means to run at the 0th minute. (If it were an *, the script would run every minute during every second hour.)

Don't forget, you can check syslog to see if it ever actually ran!