|
NAMEperpok - check a perpd(8) serviceSYNOPSISperpok [-hV] [-b basedir ] [-u secs ] [-v] svDESCRIPTIONperpok is used to check that the service sv is actively running under supervision of perpd(8).The argument sv should be a service definition directory supervised by perpd(8). perpok will look for sv in the directory given with the -b option, or as set in the PERP_BASE environmental variable, or in the current directory if neither of the previous is given. perpok returns 0 to indicate success if the definition directory sv exists and is under the active supervision of perpd(8). The -u option may be given to specify a minimum uptime in secs. In this case, perpok will further check that the main service itself is running, is not resetting, does not want down, and that its uptime has been at least secs seconds. If all these conditions are met, perpok returns 0 to indicate success. If the conditions for success are not met, perpok exits non-zero. perpok is intended primarily as a utility for boolean testing in scripting environments. See the perpstat(8) and perpls(8) utilities for more detailed status reporting. OPTIONS
EXAMPLESperpok may be used as a basic dependency checking utility within service runscripts:#!/bin/sh if test ${1} = "start" ; then if ! perpok -u3 foo ; then echo "dependency foo not running" exit 1 fi # otherwise foo ok, continue to start service: exec /usr/bin/bar ... fi This example shows a runscript for a ``bar'' service that uses perpok to require a dependency on another service named ``foo''. If foo has not been running for at least 3 seconds, the runscript exits immediately. The perpd(8) supervisor running this service will then continue to try restarting it at one second intervals, until the perpok dependency check succeeds. Note that, when using perpok in a normal collection of services running under perpd(8), PERP_BASE will always be properly predefined in the runscript environment. EXIT STATUSperpok exits with the following values:
CAVEATSFor use as a dependency tool, perpok by itself is of course limited. As illustrated in the example section above, perpok may find a dependency running okay at startup, but there is no guarantee that it will continue to run for as long as the dependent service requires it.A collection of services running under perpd(8) tends to be reliable, so that the use of perpok for basic dependency checking at startup is normally adequate. Interrelated services may also use perpok in combination with runscript reset targets to implement a system of stricter dependency controls. AUTHORWayne Marshall, http://b0llix.net/perp/SEE ALSOperp_intro(8), perpboot(8), perpctl(8), perpd(8), perpetrate(5), perphup(8), perpls(8), perpstat(8), sissylog(8), tinylog(8)
Visit the GSP FreeBSD Man Page Interface. |