Where to find cron jobs and their logs on your cPanel server

Cron(chronos is the Greek word for time) jobs are tasks that run on the server at specific time intervals.

Cron jobs are stored in /var/spool/cron/username files. For plothost user, we have:

root@web [/var/spool/cron]# cat plothost
MAILTO="test@demo.plothost.com"
SHELL="/usr/local/cpanel/bin/jailshell"
* * * * * /plothost/public_html/test.php
root@web [/var/spool/cron]#

We can see the user has only one cron job – the file test.php will be executed every minute.

As an alternative, you can use the crontab command to list the cron jobs for a user. The command is: crontab -u username -l . For user plothost, we have:

root@web [/var/spool/cron]# crontab -u plothost -l
MAILTO="test@demo.plothost.com"
SHELL="/usr/local/cpanel/bin/jailshell"
* * * * * /plothost/public_html/test.php
root@web [/var/spool/cron]#

You can find the cron jobs logs in the /var/log/cron file.
To see the entries for a specific user use cat cron | grep username. For example, for the plothost user we have:

root@web [/var/log]# cat cron | grep plothost
May  2 09:07:29 web crontab[8185]: (plothost) LIST (plothost)
May  2 09:08:12 web crontab[8309]: (plothost) LIST (plothost)
May  2 09:08:12 web crontab[8310]: (plothost) REPLACE (plothost)
May  2 09:08:12 web crontab[8313]: (plothost) LIST (plothost)
May  2 09:09:01 web crond[29907]: (plothost) RELOAD (/var/spool/cron/plothost)
May  2 09:09:01 web CROND[8466]: (plothost) CMD (test.php)
May  2 09:10:01 web CROND[8698]: (plothost) CMD (test.php)
May  2 09:11:01 web CROND[8971]: (plothost) CMD (test.php)
root@web [/var/log]#

If for any reason you want to restart the crond service use:

root@web [~]# service crond restart
Redirecting to /bin/systemctl restart  crond.service
root@web [~]#

Take care when working with cron jobs. Make a backup before modifying a cron job file.

cpanel logo
cPanel Logo

Leave a Reply