centos7 把打包好的python文件 做成服务

cd /etc/systemd/system

[root@localhost system]# vi strategy.service
[Unit]
Description=xxxx
After=multi-user.target

[Service]
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/opt/strategy-web/app     #执行文件的路径
WorkingDirectory=/opt/strategy-web    #工作目录
Restart=always

[Install]
WantedBy=multi-user.target

 

chmod 644 strategy.service

systemctl daemon-reload  #马上生效

systemctl start strategy    #测试启动

systemctl stop strategy

posted @ 2021-07-02 11:15  没有尾巴的狗  阅读(199)  评论(0编辑  收藏  举报