systemd 模板 通过systemctl查看.service文件

[Unit]
Description=XXX
After=network.target YYY.target

[Service]
Type=forking
PIDFile=/run/XXX.pid
ExecStartPre=/usr/bin/rm -f /run/XXX.pid
ExecStartPre=/path/to/<preStartCMD2>
ExecStart=/path/to/cmd/<startCMD>
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
StandardOutput=append:/var/log/XXX.log
StandardError=append:/var/log/XXXerr.log


[Install]
WantedBy=multi-user.target

通过systemctl查看.service文件

systemctl show --property=FragmentPath docker
systemctl  show docker  | grep  FragmentPath

参考:https://www.cnblogs.com/wshenjin/p/9876062.html

posted @ 2023-03-22 10:57  小黑狐狸1001  阅读(87)  评论(0编辑  收藏  举报