supervise
wrapper
With svclean,
svscan
runs the supervise
wrapper instead of
supervise
itself.
$PATH
to the value of
$SUPERVISE_PATH
(which was set by
svclean-svscan to the original
value of $PATH
) and unsets
$SUPERVISE_PATH
.
$SUPERVISE_ENV
is set, it uses that directory to configure its environment with
envdir
.
svclean/redirect_2_1
" exists
within the service directory, then file descriptor 1 is dup'ed to
descriptor 2, so supervise
's error output will go to
the service's own logger.
svclean/keep_5
" exists
within the service directory, descriptor 5 is not closed;
otherwise, it is. Likewise for svclean/keep_4
and
descriptor 4, and for svclean/keep_3
and descriptor
3.
svclean/shutdown
" does not
exist within the service directory, then descriptor 0 is put in
blocking mode for loggers, and supervise
is executed
normally. Otherwise, for normal services (and for loggers whose
descriptor 0 is not immediately readable), the wrapper exits
without running supervise
; for loggers whose
descriptor 0 is immediately readable, descriptor 0 is made
non-blocking and supervise
is executed. Loggers are
expected to exit after they read all currently available input and
descriptor 0 is in non-blocking mode; the next read will result in
EAGAIN
.
multilog
behaves this way.
Add this command to your system boot scripts, to ensure that your services come up:
rm -f /service/*/svclean/shutdown /service/*/log/svclean/shutdown
The wrapper distinguishes normal services from loggers by checking whether
descriptor 0 is a pipe. Do not run svclean-svscan
with a pipe
on descriptor 0.