How to find and list the cron jobs of hosting account in a WHM cPanel servers

How to find and list the cron jobs of hosting account in a WHM cPanel servers

Many in the hosting Industry uses the CPANEL/WHM for providing web hosting services.

One very common problems we face is to find and see the cron jobs run by the customers.

Running crons is not big deal on a shared hosting, but when some one configures it wrongly and running a load taking process frequently will create server overload, downtimes and you can name many here..

actually finding the cronjobs created by the cpane users is not hard.

Just use the below command, You should be logged in as root to see the result.

root@earn[/]#for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done

Running the above command will just list all the cron jobs as below.

MAILTO="[email protected]" 
5 * * * * php -q /home/cpaneluser/public_html/admin/cli/cron.php 

how to take the list and verify it one by one. if you have only 10 or 20 accounts, that wont be a problem. what if you have 1000s of accounts and has 100s of the cron jobs. its simple, You can create a file out of the command.

root@earn[/]#for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done > /home/cronlist.txt

The above command will create a file named, cronlist.txt in /home

Analyze the result on the text file and see the if some one is running frequent crons
some times, this users dont know what they are configuring as crons,

eg. they create a cron and make it run every minute.
* * * * *  /usr/bin/php -q /home/public_html/cron.php
See this cron will run every minute

0 0 * * * /usr/bin/wget
The above cron will run every day at 00.00AM

To understand this * & nos, refer the below format.
* * * * * /path of the file
First * is Minute
Second * is Hour
Third * is Day
Fourth * is Month
Fifth * is day of the week

* mean every day or hour or month

That is all, I like to share today, just drop in your comments, and dont hesitate to comment and correct me if i am wrong,
I have tested this & verified it on a Cpanel/Whm server in a centos Operating System.

2 Replies to “How to find and list the cron jobs of hosting account in a WHM cPanel servers”

  1. An even easier way to use which manages multiple sites and provides feedback and reporting.


This site uses Akismet to reduce spam. Learn how your comment data is processed.