标签归档:web.py

web.py注册为服务(centos7)

命令行脚本:

/usr/bin/python /mnt/www/xxx/scripts/mq.py

创建服务文件(服务名xxx)

vim /usr/lib/systemd/system/xxx.service

xxx.service 文件内容

[Unit]
Description=The doufu python message queue server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=simple
#PIDFile=
#ExecStartPre=
#ExecStartPre=
ExecStart=/usr/bin/python /mnt/www/xxx/scripts/mq.py
ExecReload=/usr/bin/python /mnt/www/xxx/scripts/mq.py
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true

[Install]
WantedBy=multi-user.target
# 启用服务(开机自动启动)
systemctl enable xxx.service
# 查看服务状态
systemctl status xxx.service
# 开始服务
systemctl start xxx.service
# 查看服务状态
systemctl status xxx.service