复制代码 代码如下:
sed -i 's#ca/:/:ctrlaltdel/://sbin//shutdown/ /-t3/ /-r/ now#ca/:/:ctrlaltdel/://bin//sh/ //root//checksystem/.sh#' /etc/inittab
复制代码 代码如下:
init q
复制代码 代码如下:
#!/bin/bash
#History
#2011-04-28 Caoyameng ver1.0
#
test -e /root/systeminfo_lock && exit 0
touch /root/systeminfo_lock
test -e /root/systeminfo && /bin/mv /root/systeminfo /root/systeminfo_bak
echo "##1" >> /root/systeminfo
date >> /root/systeminfo
echo "##2" >> /root/systeminfo
df -h >> /root/systeminfo
echo "##3" >> /root/systeminfo
free -m >> /root/systeminfo
echo "##4" >> /root/systeminfo
iostat >>/root/systeminfo
echo "##5" >> /root/systeminfo
w >> /root/systeminfo
echo "##6" >> /root/systeminfo
netstat -lntp >> /root/systeminfo
/sbin/ifconfig >> /root/systeminfo
echo "##7" >> /root/systeminfo
iptables -L >> /root/systeminfo
echo "##8" >> /root/systeminfo
ping -c 2 -W 2 127.0.0.1 >> /root/systeminfo
ping -c 2 -W 2 这里改成eth0的IP >> /root/systeminfo
ping -c 2 -W 2 这里改成eth1的IP(如果有eth1)>> /root/systeminfo
ping -c 2 -W 2 >> /root/systeminfo
echo "##9" >> /root/systeminfo
route -n >> /root/systeminfo
echo "##10" >> /root/systeminfo
/etc/init.d/iptables stop
echo "##11" >> /root/systeminfo
/etc/init.d/sshd restart
/etc/init.d/network restart
####################
sleep 60
sed -i 's#ca/:/:ctrlaltdel/://bin//sh/ //root//checksystem/.sh#ca/:/:ctrlaltdel/://sbin//shutdown/ /-t3/ /-r/ now#' /etc/inittab
rm -f /root/systeminfo_lock
init q
新闻热点
疑难解答
图片精选