bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#74279: Shepherd service is not getting respawned.


From: Tomas Volf
Subject: bug#74279: Shepherd service is not getting respawned.
Date: Sat, 09 Nov 2024 15:58:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi,

I wrote a shepherd service to function as a check for networking being
actually up, but it does not get respawned when it fails and I do not
understand why.

This is the service in my operating-system:

--8<---------------cut here---------------start------------->8---
(simple-service
 'network-online
 shepherd-root-service-type
 (list (shepherd-service
        (requirement '(networking))
        (provision '(network-online))
        (documentation "Wait for the network to come up.")
        (start #~(lambda _
                   (let* ((cmd "/run/privileged/bin/ping -qc1 -W1 1.1.1.1")
                          (status (system cmd)))
                     (= 0 (status:exit-val status)))))
        (one-shot? #t)
        ;; Try every second.
        (respawn-delay 1)
        ;; Retry forever.  Double-quoting is intentional.
        (respawn-limit ''(5 . 5)))))
--8<---------------cut here---------------end--------------->8---

Now, when I reboot the machine, I see in the log that the service did
start:

--8<---------------cut here---------------start------------->8---
Nov  7 00:18:20 localhost shepherd[1]: Starting service network-online...
[..]
Nov  7 00:18:20 localhost shepherd[1]: [sh] PING 192.168.0.110 (192.168.0.110): 
56 data bytes
Nov  7 00:18:20 localhost shepherd[1]: [sh] /run/privileged/bin/ping: sending 
packet: Network is unreachable
Nov  7 00:18:20 localhost shepherd[1]: Service network-online could not be 
started.
Nov  7 00:18:20 localhost shepherd[1]: Service network-online failed to start.
--8<---------------cut here---------------end--------------->8---

The fail on first run is expected, however the problem is it starts
exactly once.  I do not see any attempts to respawn it in the
/var/log/messages, but based on the documentation the service *should*
get respawned, since it failed.  What am I doing wrong?  Would anyone
have any suggestions, either what is wrong with the code above or how to
approach it in another way?

Have a nice day,
Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]