How to run cron job every 2 hours

Vignesh picture Vignesh · Jun 21, 2011 · Viewed 367.9k times · Source

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

Answer

Adam picture Adam · Feb 24, 2012

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!