ubuntu 关机时如何执行一个或多个命令和脚本?系统启动时是否有/etc/profile 和 ~/.bashrc 之类的脚本? 我知道linux shutdown可能有很多原因,除了处理kill signal外,这个原因哪里找?
最佳答案
Is there any script like /etc/profile and ~/.bashrc at system starting?
SysV Init 脚本 (/etc/init.d/*
) 在启动时调用。在系统启动时调用某些事件的一种简单/简单的方法是将其放入 /etc/init.d/local
(/etc/rc.local
对于其他一些发行版).另请参阅:RcLocalHowto .
How to execute one or more commands and scripts when ubuntu shutdown?
这听起来好像您想创建一个真正的 init 脚本,该脚本在进入运行级别 X-Z 时得到 start
ed,在退出它们时得到 stop
ped。另请参阅:UbuntuBootupHowto .
I know linux shutdown may have many causes, in addition to dealing with the kill signal, where can I get for this reason?
非交互地做到这一点并不简单。您可以通过 grep 浏览系统日志,查找来自 shutdown
的指示。
关于linux - ubuntu 关机时的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8529424/