How to make systemd wait until process started

How to make systemd wait until process started



As shown below I am using below configuration where process2 is dependent on process1 to start. Is there a way to block starting process2 until process1 is completely started ? Currently it seems once fork is done on process1, process2 is just started off.


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






what constitutes process1 being "completely started" ? Is it your code?

– danblack
Oct 15 '18 at 0:10






Instead of ExecStop you should be using just PidFile=/var/run/process2.pid

– danblack
Oct 15 '18 at 0:22


ExecStop


PidFile=/var/run/process2.pid




0



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)