用Systemd服务的方式部署Python做的网站

服务名:test1.service
新建文件/lib/systemd/system/test1.service

[Unit]
Description=gunicorn daemon 
After=network.target

[Service]
PIDFile=/run/gunicorn/test1.pid
User=lbp

WorkingDirectory=/opt/superset/superset
ExecStart=/usr/bin/gunicorn --pid /run/gunicorn/test1.pid -w 2 -b :8000 test1:app
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
sudo systemctl enable test1.service
sudo systemctl start test1.service
sudo systemctl status test1.service

猜你喜欢

转载自blog.csdn.net/lbp0408/article/details/80381323
今日推荐