For a Linux server, the ability to automate certain tasks is one of its shining features. Cron jobs are automated tasks that the user instructs the server to run at certain intervals. These intervals can be daily, hourly, monthly, or even every few minutes, if the user desires.
Normally, running cron jobs requires shell access to edit crontab or link to scripts in cron.hourly, cron.daily, or other preset directories. Fortunately, cPanel gives users the ability to create cron jobs even if they do not have full access to the server. These user-based cron jobs are useful for certain web applications that may require some automation of their server-side scripts.
To create a cron job in cPanel, follow these instructions:
- Login to cPanel
- In the “Advanced” section, select “Cron jobs”
- Enter your email address in the “Cron Email” box to receive notifications of completed tasks and errors Note: If you do not wish to receive notifications, you should append “ >/dev/null 2>&1” to your command to have it deleted rather than emailed.
- Specify the timing of your cron job. Note: Common settings make it easier to select the times you want.
- Enter your command. You will need some knowledge of Linux command line execution in order to use the command correctly. If you are running a script from one of your web applications, be sure to follow the provided directions. Example command: “/usr/bin/mycommand >/dev/null 2>&1”
- Click “Add New Cron Job” to complete the process.
You can add additional cron jobs using the same form, and all cron jobs you have added will be displayed at the bottom. For more information about cron jobs in general, see this quick reference guide.