编写xxx.service
cd /etc/systemd/system/ sudo nano xxx.service
填写以下内容:
[Unit] Description=XXXX After=network.target [Service] ExecStart=/bin/bash /opt/leo/py_space/KeyPersonRecServer/run.sh WorkingDirectory=/opt/leo/py_space/KeyPersonRecServer Restart=always [Install] WantedBy=multi-user.target
reload配置:
sudo systemctl daemon-reload
服务设置
sudo systemctl enable xxxx.service sudo systemctl start xxxx.service sudo systemctl restart xxxx.service sudo systemctl stop xxxx.service
==
标签:opt,py,xxxx,service,python,sudo,程序,systemctl,Linux From: https://www.cnblogs.com/leokale-zz/p/18129152