Web Hosting / cPanel

How to Create a Cron Job in CPanel

Oct 19, 2022
6 min read
Setup a Cron Job in cPanel

Cron jobs run simple commands, shell scripts, and programs written in languages such as PHP, Python, Node.js, and Perl. Basically, any task that can be done in the command line can be automated and run on a set schedule.

Typical uses for a cron job include:

  • Log management - Delete old logs to prevent them from becoming unmanageable.
  • Sending emails - Send notifications to users when they approach their resource limits.
  • Updating software - Automatically check software for updates and apply them.
  • Backups - Schedule backups for website files and databases

How to set up a Cron Job in cPanel

Accessing your server using the Terminal feature is as simple as logging into your cPanel account and clicking a couple of links.

How to Edit an Existing Cron Job

How to Delete an Existing Cron Job

Frequently Asked Questions

How do I know if a cron job is running or not in cPanel?

Checking the Cron Job logs requires root access. If you have root access, you can run the following command (replace “scriptname.php” with the name of your script):

grep "scriptname.php" /var/log/cron

If you have shared hosting, no root access, or do not wish to use the command line, you should specify a cron job email. Because this could quickly flood your inbox, you may want to set up a specific email address for this purpose.