我在服务器上运行Debian 6。 在这台服务器上,我希望有一个Apache2的实例,MySQL在系统引导时启动。
为此我知道init.d脚本和rc.d目录中的符号链接。
我可以使用sysv-rc-conf命令检查configuration:
┌ SysV Runlevel Config -: stop service =/+: start service h: help q: quit ─┐ │ │ │ service 1 2 3 4 5 0 6 S │ │ ---------------------------------------------------------------------------- │ │ apache2 [ ] [X] [X] [X] [X] [ ] [ ] [ ] │ │ mysql [ ] [X] [X] [X] [X] [ ] [ ] [ ] │ │ │ └───────────────────────────────────────────────────────────────────────────────┘
所以我尝试用reboot命令重启机器。 然后我testing我的服务:
root@server:~# /etc/init.d/apache2 status Apache2 is NOT running. root@server:~# /etc/init.d/mysql status MySQL is stopped..
我想检查符号链接,但他们看起来不错:
root@server:~# ls -l /etc/rc2.d/ (...) lrwxrwxrwx 1 root root 15 Mar 12 22:12 S02mysql -> ../init.d/mysql lrwxrwxrwx 1 root root 13 Sep 22 2011 S02ssh -> ../init.d/ssh lrwxrwxrwx 1 root root 17 Mar 12 22:12 S03apache2 -> ../init.d/apache2 lrwxrwxrwx 1 root root 18 Jan 24 2012 S03rc.local -> ../init.d/rc.local (...)
你有什么想法,为什么这不工作?
也许你应该尝试使用chkconfig包
apt-get install chkconfig once done, chkconfig mysql on chkconfig apache2 on
如果由于某种原因不起作用,您可以添加
echo "/etc/init.d/mysql start" >> /etc/rc.local echo "/etc/init.d/apache2 start" >> /etc/rc.local
重新启动并testing