A. if you press ctrl + alt + del for the first time and press ctrl + del within 60 seconds, the firewall will be disabled and the sshd service will be restarted after N information collection tasks are executed;
B. If the server cannot be connected, press ctrl + alt + del to restart the server.
The procedure is as follows:
1. First modify the current/etc/inittab file and change the default restart to/root/checksystem. sh.
Copy codeThe Code is as follows: sed-I's # ca \: ctrlaltdel \: \/sbin \/shutdown \-t3 \-r \ now # ca \:\: ctrlaltdel \: \/bin \/sh \/root \/checksystem \. sh # '/etc/inittab
2. Run the "init q" command to reload the file.Copy codeThe Code is as follows: init q
3. Create the/root/checksystem. sh script file. The content is as follows. The specific meaning is not detailed. You can enrich the content on your own.Copy codeThe Code is 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 here, change to the IP address of eth0>/root/systeminfo
Ping-c 2-W 2 here change to the IP address of eth1 (if eth1 exists)>/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