Adding a cron job
Posted by David, Last modified by Ashley L on 20 November 2019 12:59 PM

Cron jobs allow you to automate certain commands or scripts on your server to complete repetitive tasks automatically. A cron job allows you to run a certain command at times set by the job. For example, you could set a cron job to delete temporary files every week so that your disk space is not being used up by those files. Standard mode gives you a range of pre-set options for adding your cron job and is easier to use than advanced mode.
 
Here are the following steps:

  1. To access the Cron Jobs Menu, click the words "Cron Jobs" on the main screen of your cPanel interface
  2. Click on "Standard" to access the Standard Cron Manager
  3. Enter the email address you wish the output of the command run by the cron job to be sent to in the field next to ".... Will Be Sent:"
  4. Enter the command you wish the cron job to run in the blank field next to "Command to Run:"
  5. Select how often you wish the command to be run by selecting an option in each of the boxes
  6. Click on "Save Crontab" to save your changes and set up your cron job

Troubleshooting: The command run by the cron job must be a valid command. Try running the command first from the command line to make sure it works before adding it to a cron job.

Note that there's also the 'advanced' cron job mode:

Advanced mode allows you to add a cron job just as you would from the command line.

 Here are the following steps:

  1. To access the Cron Jobs Menu, click on the words "Cron Jobs" on the main screen of your cPanel interface
  2. Click on "Advanced (Unix Style)" to access the Cron Manager
  3. Enter the email address you wish the output of the command run by the cron job to be sent to in the field next to ".... Will Be Sent:"
  4. Enter the command you wish the cron job to run in the blank field below "Command"
  5. Select how often you wish the command to be run by placing a number or * in each of the boxes
  6. Click on "Save Crontab" to save your changes and set up your cron job 

Troubleshooting: A * denotes to run the command at every possible time for that box. For example, a * in the month box would run the command every month. More information on cron jobs can be found by doing a Google search for "Crontab."

(344 vote(s))
Helpful
Not helpful