Flesh out documentation and improve examples

This commit is contained in:
C. McEnroe 2020-08-17 01:11:44 -04:00
parent 6302579f22
commit 84b2c1858a
3 changed files with 74 additions and 50 deletions

View File

@ -39,6 +39,9 @@ Set the path of the named pipe.
.It Cm start .It Cm start
Start any matching services Start any matching services
which are not already started. which are not already started.
Services scheduled for automatic restart
are started immediately
but their restart intervals are not reset.
. .
.It Cm stop .It Cm stop
Stop any matching services Stop any matching services
@ -49,8 +52,12 @@ signal.
. .
.It Cm restart .It Cm restart
Restart any matching services. Restart any matching services.
Started services will first be stopped, Started services will be stopped
then stopped services will be started. and started again.
Stopped services will be started.
Services scheduled for automatic restart
will be started immediately
and their restart intervals will be reset.
. .
.It Cm status .It Cm status
Log the current status of any matching services. Log the current status of any matching services.
@ -62,14 +69,21 @@ from the services list.
.It Ar signal .It Ar signal
Send the named signal Send the named signal
to the processes of any matching started services. to the processes of any matching started services.
Signal names are case-insensitive.
. .
.It Ar service ... .It Ar service ...
The list of services to operate on. The list of services to operate on.
Service names can include Service names can include
the shell-style pattern operators .Sy *?[]
.Sy *?[] . shell-style pattern operators.
Be sure to quote service name patterns Patterns must be quoted
so they are not interpreted by the shell. to be interpreted by
.Xr catsitd 8
rather than the shell.
Each service name pattern
is operated on in order,
but services matched by each pattern
are in unspecified order.
.El .El
. .
.Sh ENVIRONMENT .Sh ENVIRONMENT
@ -89,9 +103,8 @@ The default path of the named pipe.
. .
.Sh EXAMPLES .Sh EXAMPLES
.Bd -literal .Bd -literal
catsit start pounce/freenode catsit restart pounce/freenode
catsit status '*' catsit INFO 'pounce/*'
catsit USR1 'pounce/*'
.Ed .Ed
. .
.Sh SEE ALSO .Sh SEE ALSO

View File

@ -20,7 +20,8 @@ is one of the following:
.It Cm # Ar comment ... .It Cm # Ar comment ...
Lines beinning with Lines beinning with
.Ql # .Ql #
and blank lines are ignored. as well as blank lines
are ignored.
. .
.It Cm % Ar command ... .It Cm % Ar command ...
Lines beginning with Lines beginning with
@ -62,20 +63,21 @@ or which call
. .
.Sh EXAMPLES .Sh EXAMPLES
.Bd -literal .Bd -literal
# Basic services:
calico calico -H irc.example.org /var/run/calico
pounce/freenode pounce /usr/local/etc/pounce/freenode.conf
pounce/tilde pounce /usr/local/etc/pounce/tilde.conf
# Setting environment variables: # Setting environment variables:
% export PATH=$PATH:/usr/local/bin % export LANG=en_US.UTF-8
# Using variables to expand service command lines: # Expanding command lines with variables:
% pounce=/usr/local/bin/pounce % socks=/var/run/calico
% conf=/usr/local/etc/pounce calico calico -H irc.example.org $socks
pounce/freenode $pounce $conf/freenode.conf pounce pounce -U $socks pounce.conf
pounce/tilde $pounce $conf/tilde.conf
.El # Templating command lines using service names:
pounce/freenode pounce ${0#*/}.conf
pounce/tilde pounce ${0#*/}.conf
# Privileged services:
@scooper kfcgi -d -U $USER -p ~/.local -- /bin/scooper
.Ed
. .
.Sh SEE ALSO .Sh SEE ALSO
.Xr catsitd 8 .Xr catsitd 8

View File

@ -47,7 +47,7 @@ daemon spawns processes for a list of
redirects their output to syslog, redirects their output to syslog,
and restarts the processes when they exit and restarts the processes when they exit
according to their exit status. according to their exit status.
Exponential backoff is applied to restarts. Exponential backoff is applied to automatic restarts.
. .
.Pp .Pp
The list of services is defined in a The list of services is defined in a
@ -60,9 +60,9 @@ through a named pipe.
The The
.Xr catsit 8 .Xr catsit 8
utility is a wrapper utility is a wrapper
around the named pipe, for writing to the named pipe,
and its manual page and its manual page
describes the control command format. describes the control command syntax.
. .
.Pp .Pp
The arguments are as follows: The arguments are as follows:
@ -76,10 +76,12 @@ By default the working directory is
. .
.It Fl c Ar control .It Fl c Ar control
Set the path of the named pipe Set the path of the named pipe
used for control. used for service control.
. .
.It Fl d .It Fl d
Do not run as a daemon. Do not run as a daemon.
Log to standard error
as well as syslog.
. .
.It Fl f Ar config .It Fl f Ar config
Set the path of the Set the path of the
@ -92,7 +94,7 @@ Change group to
before starting services. before starting services.
If If
.Fl u .Fl u
is used, is set,
the default group is the user's group. the default group is the user's group.
. .
.It Fl p Ar pidfile .It Fl p Ar pidfile
@ -118,11 +120,12 @@ The default list contains the values of
.Dv EX_USAGE , .Dv EX_USAGE ,
.Dv EX_DATAERR , .Dv EX_DATAERR ,
.Dv EX_NOINPUT , .Dv EX_NOINPUT ,
.Dv EX_OSFILE , .Dv EX_OSFILE
and
.Dv EX_CANTCREAT .Dv EX_CANTCREAT
defined in defined in
.Xr sysexits 3 . .Xr sysexits 3 .
The exit statuses 127 and 126 The exit statuses 126 and 127
are always treated as stop exits. are always treated as stop exits.
. .
.It Fl t Ar restart .It Fl t Ar restart
@ -137,36 +140,42 @@ The default interval is 1 second.
Change user to Change user to
.Ar user .Ar user
before starting services. before starting services.
Services which are
.Em privileged
are started without changing user.
The
.Xr catsit.conf 5
manual page
describes privileged services.
.El .El
. .
.Pp .Pp
When the The
.Nm .Nm
daemon receives the daemon takes the following actions
.Dv HUP in response to signals:
signal, .Bl -tag -width Ds
the .It Dv HUP
The
.Xr catsit.conf 5 .Xr catsit.conf 5
file is reloaded. file is reloaded.
Modified services Services are not automatically
are not automatically restarted, started, stopped or restarted.
newly added services Removed services can be dropped with
are not automatically started, .Xr catsit 8 .
and removed services
are not automatically stopped.
. .
.Pp .It Dv TERM
When the The named pipe used for service control
.Nm is closed and unlinked.
daemon receives the All services are stopped,
.Dv TERM after which
signal,
the named pipe is closed,
all services are stopped,
and
.Nm .Nm
exits. exits.
. .
.It Dv INFO
The current status of all services is logged.
.El
.
.Sh ENVIRONMENT .Sh ENVIRONMENT
Services are started Services are started
with empty environments with empty environments
@ -196,7 +205,7 @@ The default path of the
file. file.
.It Pa /var/run/catsitd.pipe .It Pa /var/run/catsitd.pipe
The default path of the named pipe The default path of the named pipe
used for control. used for service control.
.El .El
. .
.Sh SEE ALSO .Sh SEE ALSO