尽pipe我在/ etc / rc0目录下创build了一个文件来让它在启动时运行,但是我没有执行。 相反,当在/ etc / rc6目录下创build相同的文件时,它将在执行后停止执行。
K99startup.sh – > ../init.d/startup.sh*
我正在使用Ubuntu 12.04
您可以从/etc/rc.local调用脚本,这是自定义脚本在启动时运行的正确位置。
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /usr/local/bin/your-script exit 0
运行级别6在重新启动时使用。 http://www.debian-administration.org/articles/212
尝试使用/etc/rc2.d并将其命名为S99startup.sh,S前缀为Start,K前缀为Kill。
这很正常。 Linux运行级别6是重新启动/关机。 你正在寻找的是运行级别3或/和5。
pipe理启动脚本的标准工具是chkconfig或update.rc 。 但是,如果你想成为“边缘”,你可以使用暴发户 – 这是前段时间在Ubuntu中提出的。
Upstart作业位于/etc/init – 您只需复制现有作业并将其用作示例/模板来为脚本编写自己的作业。 大多数人build议查看/etc/init/mysql.conf并从那里开始。