systemctl

ywhao 发布于 2022-10-02 79 次阅读


command = [enable, disable, start, stop, restart,status]

systemctl command yourServiceName.service

更新服务systemctl daemon-reload

例:

[Unit]
Description=ywhtcp
After=network.target

[Service]
Type=simple
User=root
Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/python38/bin/python3 /ywhtcp.py
PrivateTmp=true

[Install]
WantedBy=multi-user.target

注:service只允许用绝对路径,就算全局python也不行

  • wechat_img
03,双鱼,爱学习。
最后更新于 2022-10-02