b,如果还是连不上服务器,那继续让机房工程师按ctrl+alt+del机器就会真的重启。
具体作业步骤如下:
1,首先修改当前的/etc/inittab文件,将默认的重启改为执行/root/checksystem.sh
sed -i 's#ca\:\:ctrlaltdel\:\/sbin\/shutdown\ \-t3\ \-r\ now#ca\:\:ctrlaltdel\:\/bin\/sh\ \/root\/checksystem\.sh#' /etc/inittab
2,然后使用 “ init q ”这个命令重载文件
init q
3,接下来创建/root/checksystem.sh 这个脚本文件 。内容如下,具体含义就不详解了,大家可以自行丰富内容。
#!/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 www.linuxtone.org >> /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
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!