Here is a question for judging the normal shutdown of Linux. Xiaobian collected some information for everyone to see, I hope everyone can get help from it.
when the system starts to generate a file, linux, when the normal shutdown will delete this file. The network administrators can judge whether the abnormal shutdown is based on whether there is a file at the time of booting the system, and reduce the probability of failure in the network management process.
steps:
in /etc/rc.d/init.d/programming scripts. !
determine whether the normal shutdown, and generate a script file: touch-file.sh
# /bin /sh file = /tmp /check if [-e $]; then echo " this is not normal shutdown "
& gt; & gt; /var /log /checkmessage else echo " this is normal shutdown and touch file "
& gt; & gt; /var /log /checkmessage touch script under $ fi
linux normal shutdown deleted files: rm-file.sh
# /bin /sh file = /tmp /check echo " this is normal shutdown and! rm file "
& gt; & gt; /var /log /checkmessage rm -rf $
the script automatically.
ln -s /etc/rc.d/rc0.d/K01rm-file /etc/rc.d/init.d/rm-file.sh
Note:
#ll /etc/rc.d/rc0.d/
soft on both sides of the connection it a name which is not the same, after a path can be absolute or relative path, do ensure that both sides of the name Different.
ln -s /etc/rc.d/rc6.d/K01rm-file /etc/rc.d/init.d/rm-file.sh ln -s
/etc /rc.d/rc3.d/S01touch-file /etc/rc.d/init.d/touch-file.sh
my system is useless to the x-window, so there is no level5, that is, There is no need to drop the script in /etc/rc.d/rc5.d/.
special attention:
beginning
K representative system shut down when the execution on behalf of the beginning of the S boot time execution. Pay attention to the specification of server scripting, because the soft link opened by K does not necessarily execute automatically when it is shut down. Why is this? When executing K script, it will query whether there is K with /var/lock/subsys/. The empty file name with the same name as the opening script, if not, will not be executed. Therefore, according to the specification of the server script, when starting, touch an empty file with the same name as K01 in /var/lock/subsys/:
# /var /lock /subsys #touch fm-file
over to you on that judgment in the normal shutdown of linux.
date command The function of the date command is to display and set the system date and time. The ge
The linux shell has its own set of flow control statements, including conditional statements (if),
diskless boot everyone should have heard of it, and now many Internet cafes and enterprises have use
The Go language (ie Golang) is a programming language originally developed by Google. It has severa
Linux multi-cpu load balancing - thread migration
Talking about the clock debugging in the driver development
Linux operating system startup process detailed
Install ADSL Internet Dialer under SUSE Linux
Linux view directory size and hard disk size
A Shell tool: jsondiff.sh Using the basic tutorial
Redhat/Centos NIC binding basic tutorial
How to clean large files under Linux
Windows7 market soared to 3.7% global piracy
How to replace Win8 lock screen wallpaper How to automatically replace Win8 lock screen wallpaper
Microsoft example makes Windows Phone 8 application more energy efficient development method
What should I do if Win7 displays "Error when parsing" when I open Group Policy via Gpedit.msc?
CD burning notes and burning tips
360 hot news will always pop up too annoying how to solve
Tips: buy a brand server or assemble a server?
Win10 system refuses the subsequent version update method
Windows7 can not open the online banking page solution summary