* modules/shepherd/service.scm (service-running-value): New function.
(query-service-controller), (enable-service), (disable-service),
(record-service-respawn-time), (start-service), (stop-service),
(service-registry), (handle-service-termination): Use it.
* modules/shepherd/service.scm (query-service-controller): New function based
on the previous not-so-well named service-control-message. Use cut instead of
the now deleted service-control-message.
(service-control-message): Deleted.
* modules/shepherd/service.scm (start-service): Only call start-in-parallel if
there are dependencies to start. This reduces log noise on verbose logging.
(stop-service): Use WHEN instead of AND and BEGIN.
(start-in-parallel): Reindent.
* modules/shepherd/support.scm (caught-error): Deleted.
* modules/shepherd/service.scm (stop-service): Replace the use of caught-error
with log-with-backtrace and local-output.
* modules/shepherd/service.scm (spawn-service-controller): Add fatal log when
the controller fiber errors.
(essential-task-thunk): Add a fatal log when an essential task errors.
* modules/shepherd/service.scm (report-exception): Rename to
report-action-error. Also switch the service and action arguments.
(start-service), (perform-service-action): Adjust accordingly.
This makes sure that Shepherd continues listening for commands if some error
happens while reading them from the socket or from stdin.
* modules/shepherd.scm (run-daemon): Wrap command reading and processing with
call-with-error-handling.
(process-textual-commands): Ditto.
There are some services that take a few seconds to start up before they
end up failing. Let's cover those use-cases.
* modules/shepherd/service.scm (default-respawn-limit): Increase the time
range to 30 seconds.
* modules/shepherd/service.scm (respawn-service): Ignore disabled services.
Also reorder the disabling of the service to happen before we print that it
has been disabled.
This is helpful for systems without ‘signalfd’, which may react more
slowly, and when testing on slower machines.
* tests/forking-service.sh: Define ‘within_seconds’ and use it when
checking service death and respawn. Set #:respawn-delay for ‘test2’.
Previously, failing services would be listed as many times as they had
been unsuccessfully started.
* modules/shepherd/service.scm (start-in-the-background): Add call to
‘delete-duplicates’ when displaying FAILURES.
Fixes a portability issue for GNU/Hurd.
* modules/shepherd/service.scm (make-inetd-constructor): Add ‘fcntl’
calls before calling ‘spawn-child-service’.
This fixes execution on GNU/Hurd, where ‘setsockopt’ would return
ENOPROTOOPT.
* modules/shepherd/service.scm (endpoint->listening-socket): Do not set
SO_REUSEADDR on AF_UNIX sockets.
This is used on GNU/Hurd when not running as PID 1.
* modules/shepherd/service.scm (check-for-dead-services): Send a message
to the process monitor instead of calling ‘respawn-service’.