A, the first press Ctrl+alt+del after 60 seconds and then invalid, after the execution of the N-multi-information collection operations will be the firewall deactivated, sshd service restart;
b, if still not connected to the server, then continue to let the engine room engineer Press Ctrl+alt+del machine will really restart.
The specific job steps are as follows:
1, first modify the current/etc/inittab file, and change the default reboot to execute/root/checksystem.sh
Copy Code code as follows:
Sed-i ' s#ca\:\:ctrlaltdel\:\/sbin\/shutdown\ \-t3\ \-r\ now#ca\:\:ctrlaltdel\:\/bin\/sh\ \/root\/checksystem\.sh# '/ Etc/inittab
2, and then use the command "Init Q" to overload the file
Copy Code code as follows:
3, next create/root/checksystem.sh this script file. Content as follows, the specific meaning of the unknown, we can enrich their content.
Copy Code code as follows:
#!/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 is converted to eth0 IP >>/root/systeminfo
Ping-c 2-w 2 is changed here to eth1 IP (if there is 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