/etc/rc.local

/etc/rc.local是/etc/rc.d/rc.local的软连接
应用于指定开机启动的进程
开机启动不生效,则首先需要检查下/etc/rc.d/rc.local是否具有可执行权限

在配置文件中写入进程启动的指令,同时在/lib/systemd/system/下指定想要加的进程文件,

ex: supervisor

1.
echo "/usr/bin/supervisord -c /etc/supervisord.conf" >> /etc/rc.local

2.
vim /lib/systemd/system/supervisor.service

格式:
[Unit]
Description=supervisor
After=network.target

[Service]
Type=forking
# 进程启动停止重载的指令

ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf  
ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown
ExecReload=/usr/bin/supervisorctl $OPTIONS reload
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

猜你喜欢

转载自www.cnblogs.com/0916m/p/11707785.html