While @einterview’s answer is almost correct, it’s important to note that a *
in the minute column will run the job every minute of that hour. If intending to run once every hour, steps would be:
-
SSH into server.
-
Get list of current user’s jobs with
$ crontab -l
-
Edit jobs list with
$ crontab -e
(default editor will open) -
Add
0 4 * * * service mysql restart
for mysql at 4:00am -
Add
0 5 * * * service apache2 restart
for apache2 at 5:00am -
Add
0 0 * * * service apache2 restart
for apache2 at 12:00 am -
Save and close (Ctrl+O and Ctrl+X in nano)
-
Recheck with
$ crontab -l