catsit/catsitd.8

227 lines
3.9 KiB
Groff

.Dd August 16, 2020
.Dt CATSITD 8
.Os
.
.Sh NAME
.Nm catsitd
.Nd process supervisor
.
.Sh SYNOPSIS
.Nm
.Op Fl d
.Op Fl C Ar path
.Op Fl c Ar control
.Op Fl f Ar config
.Op Fl g Ar group
.Op Fl p Ar pidfile
.Op Fl r Ar reset
.Op Fl s Ar stopexits
.Op Fl t Ar restart
.Op Fl u Ar user
.
.Sh DESCRIPTION
The
.Nm
daemon
is a process supervisor for
.Fx
and
.Ox .
It is designed to supervise processes
with the following behavior:
.Bl -enum
.It
The process runs in the foreground,
not as a daemon.
.It
The process logs to standard output or standard error.
.It
The process handles errors by exiting
and expects to be restarted.
.It
The process indicates its reason for exiting with
.Xr sysexits 3 .
.El
.
.Pp
The
.Nm
daemon spawns processes for a list of
.Em services ,
redirects their output to syslog,
and restarts the processes when they exit
according to their exit status.
Exponential backoff is applied to automatic restarts.
.
.Pp
The list of services is defined in a
.Xr catsit.conf 5
file.
The services managed by
.Nm
can be controlled
through a named pipe.
The
.Xr catsit 8
utility is a wrapper
for writing to the named pipe,
and its manual page
describes the control command syntax.
.
.Pp
The arguments are as follows:
.Bl -tag -width Ds
.It Fl C Ar path
Change directory to
.Ar path
before starting services.
By default the working directory is
.Pa / .
.
.It Fl c Ar control
Set the path of the named pipe
used for service control.
.
.It Fl d
Do not run as a daemon.
Log to standard error
as well as syslog.
.
.It Fl f Ar config
Set the path of the
.Xr catsit.conf 5
file.
.
.It Fl g Ar group
Change group to
.Ar group
before starting services.
If
.Fl u
is set,
the default group is the user's group.
.
.It Fl p Ar pidfile
Write the PID of the
.Nm
process to
.Ar pidfile .
.
.It Fl r Ar reset
Set the interval in milliseconds
for which a process must live
to have its service restart interval
reset to the initial value.
The default interval is 15 minutes.
.
.It Fl s Ar stopexits
Set the list of exit statuses
for which a restart will not be attempted.
The
.Ar stopexits
argument is a comma-separated list of integers.
The default list contains the values of
.Dv EX_USAGE ,
.Dv EX_DATAERR ,
.Dv EX_NOINPUT ,
.Dv EX_OSFILE
and
.Dv EX_CANTCREAT
defined in
.Xr sysexits 3 .
The exit statuses 126 and 127
are always treated as stop exits.
.
.It Fl t Ar restart
Set the initial interval in milliseconds
between automatic restarts.
This interval is doubled
each time a service
is automatically restarted.
The default interval is 1 second.
.
.It Fl u Ar user
Change user to
.Ar user
before starting services.
Services which are
.Em privileged
are started without changing user.
The
.Xr catsit.conf 5
manual page
describes privileged services.
.El
.
.Pp
The
.Nm
daemon takes the following actions
in response to signals:
.Bl -tag -width Ds
.It Dv HUP
The
.Xr catsit.conf 5
file is reloaded.
Services are not automatically
started, stopped or restarted.
Removed services can be dropped with
.Xr catsit 8 .
.
.It Dv TERM
The named pipe used for service control
is closed and unlinked.
All services are stopped,
after which
.Nm
exits.
.
.It Dv INFO
The current status of all services is logged.
.El
.
.Sh ENVIRONMENT
Services are started
with empty environments
apart from the following:
.Bl -tag -width Ds
.It Ev USER
Set to the name of the user specified by
.Fl u .
.It Ev HOME
Set to the home directory of the user specified by
.Fl u .
.It Ev SHELL
Set to
.Pa /bin/sh .
.It Ev PATH
Set to the system default defined by
.Dv _PATH_DEFPATH
in
.In paths.h .
.El
.
.Sh FILES
.Bl -tag -width Ds
.It Pa /usr/local/etc/catsit.conf
The default path of the
.Xr catsit.conf 5
file on
.Fx .
.It Pa /etc/catsit.conf
The default path of the
.Xr catsit.conf 5
file on
.Ox .
.It Pa /var/run/catsitd.pipe
The default path of the named pipe
used for service control.
.El
.
.Sh SEE ALSO
.Xr catsit.conf 5 ,
.Xr catsit 8
.
.Sh AUTHORS
.An June Bug Aq Mt june@causal.agency