centos7源码编译设置置开机自启动

编写启动脚本:vim httpd

#!/bin/bash
# chkconfig: 12345 80 90
function start_http()
{
/usr/local/apache2/bin/apachectl  start
}
function stop_http()
{
 /usr/local/apache2/bin/apachectl  stop
}
case "$1" in
start)
    start_http
;;  
stop)
    stop_http
;;  
restart)
    stop_http
    start_http
;;
*)
    echo "Usage : start | stop | restart"
;;
esac

加入系统服务:

chmod  a+x  httpd    --增加所属用户执行权限
cp  -arf  httpd  /etc/init.d/  将配置文件拷贝到该目录下

启动自己编写的服务:

systemctl  daemon-reload
systemctl  start  httpd

设置开机自启动:

chkconfig  --add  httpd

https://www.cnblogs.com/brightkite/p/10163610.html

猜你喜欢

转载自blog.csdn.net/tjjingpan/article/details/88078020