perpboot(8) persistent process supervision perpboot(8)
NAME
perpboot - startup utility for perpd(8) and an associated logger
SYNOPSIS
perpboot [-hV] [-dx] [ basedir ]
DESCRIPTION
perpboot is a utility for starting and monitoring a perpd(8) instance
on basedir with an associated logger. If basedir is not specified,
perpboot will use the environmental variable PERP_BASE. If PERP_BASE
is not set or empty, perpboot will use a compiled-in value for basedir,
normally /etc/perp.
Within basedir, perpboot switches into a subdirectory named .boot/. It
then forks two child processes to exec ./rc.log and ./rc.perp, with a
pipe connected between their respective stdin and stdout.
Normally ./rc.log will be an executable script that execs into a stdin
logger, such as tinylog(8) or sissylog(8). Similarly, ./rc.perp will
be an executable script that ultimately execs into perpd(8). See the
examples section below for sample scripts.
perpboot sets up its ./rc.log and ./rc.perp child processes with an
environment that:
o closes all extraneous file descriptors
o redirects unused stdin, stdout, and stderr to /dev/null
o redirects the stdin of ./rc.log to the stdout of ./rc.perp
(and vice versa)
o redirects the stderr of ./rc.perp to stdout (with the effect
that both stdout and stderr of ./rc.perp are captured by the
logger)
o sets the environmental variable PERP_BASE to the value used
for basedir
By default, perpboot itself acts as lightweight supervisor for the
./rc.log and ./rc.perp child processes. If perpboot notices that
either of these processes has died, it will try to restart them.
OPTIONS
-d Detach. Normally perpboot itself runs in the foreground. The
-d option causes perpboot to detach from the controlling termi-
nal and run as a background process. This option is useful when
starting perpboot from within a BSD-type boot script such as
rc.local.
-h Help. Print a brief usage message to stderr and exit.
-V Version. Print the version number to stderr and exit.
-x Exit. Normally perpboot stays resident as a system process that
monitors its ./rc.log and ./rc.perp child processes. The -x
option causes perpboot to start ./rc.log and then replace itself
with the ./rc.perp process. This option is used to reduce
process overhead and/or when you don't feel the need to retain
perpboot as a supervisor. As one example, this option might be
used within an inittab(5) specification configured with the
action specified as ``respawn''.
EXAMPLES
An example ./rc.log script may look like this:
#!/bin/sh
LOGDIR=/var/log/perpd
exec tinylog -k 8 -s 100000 -t ${LOGDIR}
This script execs into an instance of tinylog(8) maintaining a rotated
set of log files in /var/log/perpd with a maximum of 8 keep files, a
maximum log size of 100000 bytes, and with timestamp prepended entries.
An example ./rc.perp script