如下所示,我正在使用以下配置,其中process2依赖于process1来启动。有没有一种方法可以阻止启动process2,直到完全启动process1?目前看来,一旦在process1上完成了fork,就开始了process2。
cat process2.service
[Unit]
Description=process1
Wants=network-online.target
After=network.target
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=process1
ExecStart=/usr/bin/process1 -d
ExecStop=/bin/kill -9 `cat /var/run/process1.pid`
Restart=always
[Install]
WantedBy=multi-user.target
cat process2.service
[Unit]
Description=process2
Wants=network-online.target
After=process1.service
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=process2
ExecStart=/usr/bin/process2 -d
ExecStop=/bin/kill -9 `cat /var/run/process2.pid`
Restart=always
[Install]
WantedBy=multi-user.target