- 首先新建脚本:
1
sudo vim /etc/init.d/K99shutdownbefore.sh
文件名自己取,但是前缀最好是K99
保证进程优先级.
-
然后把要执行的命令写到这个脚本文件
-
修改文件权限,确保可被执行:
1
sudo chmod +x /etc/init.d/K99shutdownbefore.sh
-
加链接:
12
sudo ln -s /etc/init.d/K99shutdownbefore.sh /etc/rc0.d/K99shutdownbeforesudo ln -s /etc/init.d/K99shutdownbefore.sh /etc/rc6.d/K99shutdownbefore