初试 systemd

参考

damon

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
[Unit]
Description=goshs is a replacement for Python's SimpleHTTPServer
ConditionFileIsExecutable=/usr/local/bin/goshs
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/goshs -d /data/goshs -P xxxx
TimeoutSec=0
RemainAfterExit=yes

如果Type设为 simple (当设置了 ExecStart= 、 但是没有设置 Type= 与 BusName= 时,这是默认值), 那么 ExecStart= 进程就是该服务的主进程, 并且 systemd 会认为在创建了该服务的主服务进程之后,该服务就已经启动完成。

原文地址:https://www.cnblogs.com/hiyang/p/13876958.html