You may already be familiar with setting up Crons in cPanel ( a guide for this can be found here) but you may be looking to have more direct control over all the crons via SSH on your server.
You can access your server’s Crontab using the following command:
# crontab -e
By default, you will likely have several cPanel crons in here, such as backups that will be in this format:
30 23 * * * /usr/local/cpanel/scripts/upcp –cron
Cron Format
Crons all have the following format:
[minute] [hour] [day-of-month] [month] [day-of-week] [path-to-script]
- Minute can range from 0-59
- Hour can range from 0-23
- Day-of-month can range from 0-31
- Month can range from 1-12 (Where 1 = January and 12 = December)
- Day-of-week can range from 0-7 (Sunday can be either 0 or 7
Examples
Looking back at our cPanel backup example: 30 23 * * * /usr/local/cpanel/scripts/upcp –cron
This means that cpanel backups run at the 30th minute of the 23rd hour every-day, or 11:30 PM.
If you wanted backups to run at midnight, you would simply need to edit the Cron to the following:
0 0 * * * /usr/local/cpanel/scripts/upcp –cron
Now, if you say you have your own script that you would only like to run on weekdays at a certain time, you can do the following:
30 0 * * 1,2,3,4,5 /path/script/script.sh OR 30 0 * * 1-5 /path/script/script.sh
This will run ‘script.sh’  Monday-Friday at 12:30 AM
You can also have scripts run every X for a variable so, for example, if you wanted your script to run every 5 minutes you can do the following:
5 * * * 1,2,3,4,5 /path/script/script.sh OR 30 0 * * 1-5 /path/script/script.sh
Â
Other Options for the Crontab Command
- crontab -l   : Display the Crontab
- crontab -r  : Remove the Crontab
- crontab -u USER -e   : Edit the crontab for a specific user
Â
Hopefully you are now more familiar with editing the Crontab on your server. If you have any questions or concerns feel free to submit a ticket or contact us via our live support system.