系统启动的时候生成一个文件,正常关机的时候会删除这个文件。网管员们则可以根据系统开机时有没有那个文件来判断是不是非正常关机,减少网络管理过程中出现故障的机率。
步骤:
在/etc/rc.d/init.d/下编程脚本。
判断是否正常关机,和生成文件的脚本:touch-file.sh
#!/bin/sh file=/tmp/check if [ -e $ ];then echo "this is not normal shutdown"
>>/var/log/checkmessage else echo "this is normal shutdown and tou