Gandalf StormCrow Gandalf StormCrow - 3 months ago 22
Linux Question

Running cron job on linux every 6 hours

How can I run command every six hours every day? Tried this not working :

/6 * * * * * mycommand

nos nos
Answer

You forgot a * ,and you've too many fields, and it's the hour you need to care about

0 */6 * * * /path/to/mycommand

This means every 6th hour starting from 0, i.e. at hour 0, 6, 12 and 18 Which you could write as

0 0,6,12,18 * * * /path/to/mycommand