On Fr, 26.07.19 19:07, Debraj Manna (subharaj.manna@xxxxxxxxx) wrote: > Thanks Reindl for replying. > > Can we make use of the watchdog & systemd-notify functionality of systemd? > I mean something like this. > > [Unit] > Description=Test service > After=network.target > > [Service] > Type=notify > # test.sh wrapper script to call the service > ExecStart=/opt/test/test.sh > Restart=always > RestartSec=1 > TimeoutSec=5 > WatchdogSec=5 > > [Install] > WantedBy=multi-user.target > > Then in test.sh can we do something like > > #!/bin/bash > trap 'kill $(jobs -p)' EXIT > > # Start the actual service > /opt/test/service & > PID=$! > > /bin/systemd-notify --ready > while(true); do > FAIL=0 > kill -0 $PID > if [[ $? -ne 0 ]]; then FAIL=1; fi > > # curl http://localhost/test/ > # if [[ $? -ne 0 ]]; then FAIL=1; fi > > if [[ $FAIL -eq 0 ]]; then /bin/systemd-notify WATCHDOG=1; fi > > sleep 1 > done Hmm, I am not sure how I feel about such uses for WATCHDOG=1. The assumpion is always that his comes from the app itself as a hang check. But this isn't really like that, hence I'd advise against this, but of course, it's up to you how you solve this... Lennart -- Lennart Poettering, Berlin _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel