在sentos系統下,主要有兩種方法設置本身安裝的程序開機啓動。
一、把啓動程序的命令添加到/etc/rc.d/rc.local文件中,好比下面的是設置開機啓動httpd。linux
- #!/bin/sh
- #
- # This script will be executed *after* all the other init scripts.
- # You can put your own initialization stuff in here if you don't
- # want to do the full Sys V style init stuff.
-
- touch /var/lock/subsys/local
- /usr/local/apache/bin/apachectl start
二、把寫好的啓動腳本添加到目錄/etc/rc.d/init.d/,而後使用命令chkconfig設置開機啓動。
例如:咱們把httpd的腳本寫好後放進/etc/rc.d/init.d/目錄,使用apache
- chkconfig --add httpd
- chkconfig httpd on
命令即設置好了開機啓動。centos