Running a cron job on Linux every 6 hours

How can I run a team every six hours every day? Tried this does not work:

/6 * * * * * mycommand 
+117
linux cron crontab
source share
6 answers

You forgot * , and you have too many fields, and this is the hour when you need to take care of

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

This means that every 6th hour starts at 0, i.e. per hour 0, 6, 12 and 18, which you could write as

 0 0,6,12,18 * * * /path/to/mycommand 
+298
source share

You must specify the path to your command, since cron works with a widely-cut environment. You will not have all the environment variables that you have in the interactive shell session.

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

+6
source share
 0 */6 * * * command 

It would be the perfect way to say 6 hours a day.

Your team puts on 6 minutes!

+5
source share
 0 */6 * * * 

crontab every 6 hours is a frequently used cron schedule.

+1
source share

You need to use *

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

You can also go to the link https://crontab.guru/, which will help you better plan ...

0
source share

Try:

 0 */6 * * * command 

* should

-one
source share

All Articles