I have a systemd service unit:
[Unit]
After=network.target
[Service]
User=<user>
Type=forking
ExecStart=/opt/app/start.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
The /opt/app/start.sh starts several processes and forks them:
for i in 1 2 3 4 5; do
bash another_script.sh &
done
All of the things works fine, until one of the bash another_script.sh
processes exits with non zero status. I expect that systemd service should restart in this situation.
Is there any way to watch control-group failures and restart service if this happens?
systemd
does nothing because your script -start.sh
- has not failed.