WHAT'S NEW?
Loading...

How to check list of Cron jobs in cPanel Server

How to check the list of Root and Users cron jobs using an perl script easily.It's not easy to find all the cron jobs using the cron -u command if the server has 1000 account then the System admin will be confused or get mad on doing this..Lets make this simple using an perl script which will print all the cron jobs(ROOT + cPanel users) in an .txt file which will be easy to optimize the server performace

Perl script code :
#!/bin/bash
cd /var/spool/cron
ls -1 > /cronusers

for i in ` cat /cronusers`


do


echo "#########################CRON DETAILS FOR USER $i " >> /crondetails

echo "" >> /crondetils
cat $i >> /crondetils
echo "" >> /crondetils
echo "####################################################" >>/crondetails
echo "" >> /crondetils

done


Login to your Server using Putty(SSH) :
Create an file under /root/ using the following command : vim /root/croncheck.sh
Paste the code inside the file then save the file using :wq
Change the permission of the file to 755 using the command : chmod /root/croncheck.sh
Now run the script using : ./croncheck.sh

Once the script execution completed you can see the list of cron under the /crondetails

Command :
cat /crondetails

You can download the file to your PC using WINSCP or move the file to any of your hosting account and download from the cPanel

Command to move the file :
mv /crondetails /home/username/public_html

Command to copy the file :
cp /crondetails /home/username/public_html


Note : username = Username of the cPanel account where you need to move/copy the file :)

0 comments: