Skip to content

Instantly share code, notes, and snippets.

@rushipkar90
rushipkar90 / enable_spamassassin.sh
Created September 25, 2015 16:31
enable_spamassassin.sh
#!/bin/bash
cd /home
for user in `ls /var/cpanel/users`
do
test ! -d $user && continue
touch $user/.spamassassinenable $user/.spamassassinboxenable
chown $user.$user $user/.spamassassinenable $user/.spamassassinboxenable
echo $user complete
done
@rushipkar90
rushipkar90 / dms_cron.sh
Created September 25, 2015 16:30
dms_cron.sh
#! /bin/bash
echo > restorehome.txt;
echo > restoremail.txt;
CP_ACCOUNTS=`ls -1A /var/cpanel/users/ | grep -v "root"`
for user in `echo -n $CP_ACCOUNTS`
do
#echo $user;
maindomain=`cat /etc/trueuserdomains | grep -w "$user$" | cut -d : -f1`;
homedir=`cat /var/cpanel/userdata/$user/$maindomain | grep homedir | cut -d / -f2`;
#echo "$homedir";
@rushipkar90
rushipkar90 / diskusage.pl
Created September 25, 2015 16:30
diskusage.pl
#!/usr/bin/perl
use lib '/root/sysutils/modules';
use XML::Simple;
use Data::Dumper;
use XMLAPIRequest;
chomp(my $hostname = `hostname`);
$xmlapi = XMLAPIRequest->new(
'HOSTNAME' => $hostname
);
@rushipkar90
rushipkar90 / disablemodsecurity.sh
Last active September 25, 2015 16:29
disablemodsecurity.sh
## Script By Aress Guys ##
## Verifying Parameters ##
if [[ "$1" == *.* || "$1" == *.*.* && $2 != "" && "$3" == "ssl" || "$3" == 'std' ]]; then
echo "!! Wait !!"
echo ""
sleep 1
else
echo "Incorrect Parameters"
echo ""
@rushipkar90
rushipkar90 / disable_httpd_coredumps.sh
Created September 25, 2015 16:28
disable_httpd_coredumps.sh
#!/bin/bash
if grep -Fxq "ulimit -c 0" /etc/init.d/httpd
then
exit 0
else
sed -i '/ulimit -n 16384/a ulimit -c 0' /etc/init.d/httpd
/etc/init.d/httpd stop
sleep 10
/etc/init.d/httpd start
exit 0
@rushipkar90
rushipkar90 / clusterchange.sh
Created September 25, 2015 16:28
clusterchange.sh
#!/bin/sh
cd /var/cpanel/cluster/root/config
mv 69.42.58.5 173.46.7.5
mv 69.42.58.5-dnsrole 173.46.7.5-dnsrole
@rushipkar90
rushipkar90 / cleanup.sh
Created September 25, 2015 16:27
cleanup.sh
#!/bin/sh
ionice -c3 find /home/*/fantastico_backups/ -name 'backup*' -mtime +15 -exec rm {} \;
ionice -c3 find /home/*/fantastico_backups/ -name '.backup*' -mtime +15 -exec rm {} \;
ionice -c3 find /home/*/tmp/Cpanel_Form_file.upload.* -mtime +0 -exec rm {} \;
ionice -c3 find /home/*/mail/*/*/.Trash/cur/* -type f -mtime +6 -exec rm {} \;
ionice -c3 find /home/*/mail/*/*/.Trash/new/* -type f -mtime +6 -exec rm {} \;
ionice -c3 find /home/*/mail/.Trash/cur/* -type f -mtime +6 -exec rm {} \;
ionice -c3 find /home/*/mail/.Trash/new/* -type f -mtime +6 -exec rm {} \;
@rushipkar90
rushipkar90 / cleanrootmail.sh
Created September 25, 2015 16:27
cleanrootmail.sh
#!/bin/sh
/usr/sbin/exiqgrep -i -r root@`hostname`| xargs /usr/sbin/exim -Mrm > /dev/null
@rushipkar90
rushipkar90 / check-server-bandwidth.pl
Created September 25, 2015 16:26
check-server-bandwidth.pl
#!/usr/local/cpanel/3rdparty/perl/514/bin/perl
use RRDs;
use Getopt::Long;
my $server;
my $direction;
GetOptions(
"server=s" => \$server,
"direction=s" => \$direction,
);
@rushipkar90
rushipkar90 / check_domains_ns.pl
Created September 25, 2015 16:26
check_domains_ns.pl
#!/usr/local/cpanel/3rdparty/perl/514/bin/perl
#use strict;
use warnings;
use YAML::Tiny;
use Data::Dumper;
my $username = $ARGV[0];
my @dnsservers = ("8.8.8.8","8.8.4.4");