tengine 设置开机自启
Tengine设置自动启动
系统用户登录系统后启动的服务 的目录
/usr/lib/systemd/system
复制
如需要开机没有登陆情况下就能运行的程序在系统目录内
/lib/systemd/system
1 2 3 4 5 6 |
// 系统用户登录启动服务 cd /lib/systemd/system // 添加tengine配置 vi tengine.service //快捷创建文件 vi /lib/systemd/system/tengine.service |
添加以下配置信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[Unit] Description=The nginx HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid ExecStartPre=/usr/local/nginx/sbin/nginx -t ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target |
设置文件权限
chmod 745 tengine.service
设置开机启动
systemctl enable tengine.service
Tengine相关指令
1 2 3 4 5 6 |
启动tengine服务 systemctl start tengine.service 设置开机自启动 systemctl enable tengine.service 停止开机自启动 systemctl disable tengine.service 查看服务当前状态 systemctl status tengine.service 重新启动服务 systemctl restart tengine.service 查看所有已启动的服务 systemctl list-units --type=service |