centos 开机自启动设置

# 进入/etc/init.d/

cd /etc/init.d/

#创建启动脚本

touch start.sh

#编写启动脚本 前三行为必填

vim start.sh

#!/bin/bash
# chkconfig: - 85 15
# description:开机自启脚本
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

# 开启自动方式一:

/usr/lib/systemd/systemd-sysv-install enable start_nginx.sh

 

# 开启自动方式二:

开启

chkconfig start_nginx.sh on

移除

chkconfig   start_nginx.sh off

 chkconfig --del start_nginx.sh

 

posted on 2024-01-15 14:01  知了不了了之  阅读(84)  评论(0编辑  收藏  举报