Running cron job on linux every 6 hours

旧巷老猫 提交于 2019-11-27 03:01:59

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

You should include a path to your command, since cron runs with an extensively cut-down environment. You won't have all the environment variables you have in your interactive shell session.

It's a good idea to specify an absolute path to your script/binary, or define PATH in the crontab itself. To help debug any issues I would also redirect stdout/err to a log file.

rkoots
0 */6 * * * command

This will be the perfect way to say 6hrs a day.

Your command puts for 6 mins!

Nilesh Patil
0 */6 * * *

crontab every 6 hours is a commonly used cron schedule.

You need to use *

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

Also you can refer https://crontab.guru/ which will help you in scheduling better...

rkoots

Try:

0 */6 * * * command

. * has to

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!