将Apache service加入到开机启动中
最近VPS有的时候会无故重启,每次都要手动开启apache太麻烦,加到启动项里好了:
$ cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/ $ sudo vim /etc/rc.d/init.d/apachectl
文件头加入以下内容
#!/bin/sh # chkconfig: 35 65 15 # description:Startup script for Apache sevice
执行chkconfig加入启动项目
$ sudo /sbin/chkconfig --add apachectl
完毕,检查一下:
$ sudo /sbin/chkconfig --list apachectl apachectl 0:off 1:off 2:off 3:on 4:off 5:on 6:off
好了,level3和5下会启动了。