Current File : //root/patchOct24.sh |
#!/bin/bash
log_file="/etc/sentora/panel/patchOct24.log"
if [ -f "$log_file" ]
then
echo "Patch Already Updated."
exit
else
`touch $log_file`
fi
PGREP=`whereis pgrep | awk '{print $2}'`
HTTPD="httpd"
# find httpd pid
$PGREP ${HTTPD} -x
if [ $? -ne 0 ] # if apache not running
then
echo "No HTTPD running on this server.." >> $log_file
exit
else
echo "*******CSF Config Start*******" >> $log_file
fi
service_service=`whereis service | awk '{print $2}'`
echo $service_service
file='/etc/csf/csf.conf'
`sed -i '/MESSENGER = "0"/c\MESSENGER = "1"' $file`
`sed -i 's/^\(MESSENGER_HTML_IN\).*/\1 = "80,2082,2095,2086,8080" /' $file`
csf -s /bin/false
`$service_service lfd restart`
`$service_service csf restart`
`sed -i 's/#Banner none/Banner \/etc\/banner.txt/g' /etc/ssh/sshd_config`
`touch /etc/banner.txt`
`echo "If you tried more than 5 times with incorrect login credentials." >> /etc/banner.txt`
`echo "Your ISDN IP will be blacklisted in Firewall." >> /etc/banner.txt`
`$service_service sshd restart`
`sed -i '/#DisplayLogin/c\DisplayLogin \/etc\/welcome.msg' /etc/proftpd.conf`
`touch /etc/welcome.msg`
`echo "If you tried more than 5 times with incorrect login credentials." >> /etc/welcome.msg`
`echo "Your ISDN IP will be blacklisted in Firewall." >> /etc/welcome.msg`
yes | cp /etc/sentora/configs/apache/httpd.conf /etc/sentora/configs/apache/httpd.conf_bk7
echo "*******Secure Upload Start*******" >> $log_file
cd /root/
wget -O csx_createmodule.sh "http://hostingraja.info/patch/oct/24/csx_createmodule.sh"
sh /root/csx_createmodule.sh
echo "*******Sysctl Config Start*******" >> $log_file
mkdir -p /scripts/
cd /scripts/
wget -O sysctl_sem.sh http://hostingraja.info/sysctl_sem.sh
dos2unix /scripts/sysctl_sem.sh
sh /scripts/sysctl_sem.sh
if grep -q serverloadcheck "/var/spool/cron/root"; then
echo "*******Server Load Script alreadey added*******" >> $log_file
else
echo "*******Server Load Script Start*******"
cd /scripts/
wget -O serverloadcheck.sh http://hostingraja.info/Version2.7/serverloadcheck.sh
dos2unix /scripts/serverloadcheck.sh
chmod +x /scripts/serverloadcheck.sh
SH_PATH=`whereis sh | awk '{print $2}'`
echo "*/2 * * * * $SH_PATH /scripts/serverloadcheck.sh " >> /var/spool/cron/root
fi
$service_service httpd restart
service_status=`service httpd status | head -3 | tail -1 | awk '{print $2}'`
if [ "$service_status" = "active" ]; then
echo "*******Completed*******" >> $log_file
else
yes | mv /etc/sentora/configs/apache/httpd.conf_bk7 /etc/sentora/configs/apache/httpd.conf
$service_service httpd restart
echo "*******Patch update failed*******" >> $log_file
fi
service httpd status
cat /etc/sysctl.conf
service csf status
service lfd status