[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