How to run a script in crontab every 6 hours?

Crontab expression every 6 hours is a commonly used cron schedule. 

0 */6 * * *

The following key shows how each position in the cron pattern string is interpreted:

* * * * * *
| | | | | |
| | | | | day of week
| | | | month
| | | day of month
| | hour
| minute
second (optional)

How to run a script in crontab every 6 hours?

Cron Job lets you run a script to do a repetitive job in an efficient way, here's how you can schedule a cronjob for every 6 hours:

Step 1: Edit your cronjob file by running "crontab -e" command

crontab -e

Step 2: Add the following line for every 6 hours interval:

0 */6 * * * /home/ubuntu/backup.sh

Step 3: Save the file. Done!

How to restart cron after change crontab?

Cron will then examine the modification time on all crontab and reload those which have changed. Thus cron need not be restarted whenever a crontab file is modified.

But if you just want to make sure its done anyway:

sudo service cron reload

or

/etc/init.d/cron reload
sudo service cron restart
sudo systemctl reload crond

Happy coding!

How to run a script in crontab every 6 hours?
3.20 GEEK