#!/bin/sh
file=/tmp/check
if [ -e ${file} ];then
echo "this is not normal shutdown" >>/var/log/checkmessage
else
echo "this is normal shutdown and touch file" >>/var/log/checkmessage
touch ${file}
fi
正常关机删除文件的脚本:rm-file.sh
#!/bin/sh
file=/tmp/check
echo "this is normal shutdown and rm file" >>/var/log/checkmessage
rm -rf ${file}