创建服务开机自启文件
程序员文章站
2022-07-03 18:41:07
eg: vim /lib/systemd/system/nginx.service [Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx # ......
eg:
vim /lib/systemd/system/nginx.service
[unit]
description=nginx
after=network.target
[service]
type=forking
execstart=/usr/local/nginx/sbin/nginx #开启nginx服务
execreload=/usr/local/nginx/sbin/nginx reload #重载nginx服务
execstop=/usr/local/nginx/sbin/nginx quit
privatetmp=true
[install]
wantedby=multi-user.target