在centos7下使用systemctl加入自建服务
2017-12-14 18:22
676 查看
以nginx为例子
1 在/usr/lib/systemd/system/ 建立nginx.service文件 命令: touch /usr/lib/systemd/system/nginx.service
2 修改该文件 加入内容
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PATH=/usr/local/nginx
NAME=nginx
PIDFile=$PATH/logs/$NAME
ExecStartPre=$PATH/sbin/nginx -t -c $PATH/conf/nginx.conf
ExecStart=$PATH/sbin/nginx -c $PATH/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3 保存后重启机器
4 加入开机自启 systemctl enable nginx.service
1 在/usr/lib/systemd/system/ 建立nginx.service文件 命令: touch /usr/lib/systemd/system/nginx.service
2 修改该文件 加入内容
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PATH=/usr/local/nginx
NAME=nginx
PIDFile=$PATH/logs/$NAME
ExecStartPre=$PATH/sbin/nginx -t -c $PATH/conf/nginx.conf
ExecStart=$PATH/sbin/nginx -c $PATH/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3 保存后重启机器
4 加入开机自启 systemctl enable nginx.service
相关文章推荐
- CentOS7 下面使用systemctl 来管理tomcat服务
- 在CentOS 7上利用systemctl加入自己定义系统服务
- Centos7下systemctl status postgresql 命令相关研究
- MongoDB在CentOS 7上的systemctl服务配置
- CentOS7利用systemctl添加自定义系统服务
- MongoDB在CentOS 7上的systemctl服务配置
- CentOS 7 上systemctl 的用法(注意不是多个容器服务开机启动)
- 7.21 ios自动关联控件,centos systemctl使用,tomcat配置
- centos7 中 systemd systemctl管理服务的命令
- linux(centos7)中systemctl命令的使用
- Centos7下将Shell脚本转换为Systemctl start&stop Service
- 在CentOS 7上利用systemctl添加自定义系统服务
- systemctl命令的使用及服务状态的查看
- 在CentOS 7上利用systemctl添加自定义系统服务
- 在CentOS 7上利用systemctl添加自定义系统服务
- centos 7 配置php-fpm服务到systemctl
- Centos7下的systemctl命令与service和chkconfig
- 备忘:CentOS-7 使用systemctrl 管理的服务,文件打开数上限1024要改
- CentOS 7上利用systemctl添加自定义系统服务
- Centos7下的systemctl命令与service和chkconfig