Blog Archives for category scripts

Script to terminate suspended accounts on a cPanel server

Create a file called terminatesuspended.sh vi /root/terminatesuspended.sh Add the following code for i in `find /var/cpanel/suspended/ -mtime +30 | cut… Continue reading »

Correcting ownership of all cPanel Users

If you mess up with the ownership of all the users on a cPanel server, following script will help you to… Continue reading »

Script to correct the ownership and permisions for suphp cpanel server

#!/bin/bash cat /etc/trueuserdomains |cut -d: -f2 >user for i in `cat user` do find /home/$i/public_html/ -iname “*.php” -exec chmod 644… Continue reading »

Cpanel email queue notification script.

Create a file called mailqueue.sh.  vi /root/mailqueue.sh Add the following code. #!/bin/bash EMAIL=”youraddress@mail.com” MQUEUE=`find /var/spool/exim/input -name ‘*-H’ | wc -l |… Continue reading »

Some useful scripts/commands

Way to check installed perl modules in the server # perl -MCPAN -e ‘CPAN::Shell->r’ way to check syntax of zone… Continue reading »

Script to check whether backup of terminated accounts are present in server

HI, You can use the following command to check whether backup of terminated accounts are available in the server. for… Continue reading »

Shell Script To Auto Restart HTTPD (If Goes Down)

Set con job for this script: */5 * * * * /path/to/script.sh >/dev/null 2>&1 SCRIPT: # for RHEL / CentOS… Continue reading »

Remote FTP backup script

This script will backup your files from a specific folder to a remote FTP location. For each day it will… Continue reading »

Bash Script to Check Apache Memory Usage

We might have come across many situation where we need to find the memory usage by apache and which script… Continue reading »

Script to email load average when it goes above a particular threshold

vi /root/load.sh #!/bin/bash load=`uptime | awk ‘{print $(NF-2)}’ | cut -d. -f1` if [ $load -gt 4 ] then echo… Continue reading »