Sunday, January 11, 2009

Uefule Scripts.

http://www.cplicensing.net/scripts.php


perl process listening on Port 80 and 443
-----------------------------------------

root@server204: lsof -i TCP:80 | grep perl | awk '{print $2}' |xargs kill -9


root@server204: lsof -i TCP:443 | grep perl | awk '{print $2}' |xargs kill -9


Apache Down
-----------

a)Semaphore issue--run this command


ipcs -s | grep nobody | perl -e 'while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}'

b)Port 80 and 443 running for another process.

lsof -i TCP:80 | awk '{print $2}' |xargs kill -9
lsof -i TCP:443 | awk '{print $2}' |xargs kill -9

start apache.

To change IP address of DNS zone

###################################
#!/bin/bash
for i in `cat /var/named/zones`
do
perl -pi -e 's///' $i
done
####################################



Find Sync attack


netstat -pant|grep SYN|awk '{print $5}'|sort|uniq -c|sort -n|grep -v 127.0.0.1|cut -d: -f1


Kill Zombie process

ps -ef | grep mailnull | grep -v grep | awk '{print "kill -9", $2}' | sh


replace mailnull with particular proces name which has zombie

No comments: