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
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
what constitutes process1 being "completely started" ? Is it your code?
– danblack
Oct 15 '18 at 0:10