perpok(8) persistent process supervision perpok(8) NAME perpok - check a perpd(8) service SYNOPSIS perpok [-hV] [-b basedir ] [-u secs ] [-v] sv DESCRIPTION perpok 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 -b basedir Base directory. Sets the base directory containing the service definition sv. If not set, perpok will use the value set in the variable PERP_BASE, or the current directory if neither of these are defined. On a normal system, the base directory will be /etc/perp. -h Help. Print a brief usage message to stderr and exit. -u secs Uptime. Normally perpok checks only that the sv directory is active (exists and is sticky), and that perpd(8) is actively supervising it. This option extends the checks performed by perpok to test that the main service itself is running, is not resetting, does not want down, and that its uptime has been at least secs seconds. Normally it is sensible to set secs to some small value, such as 2 or 3, which is just long enough to check that the service is not cycling on restarts. -V Version. Print the version number to stderr and exit. -v Verbose. Normally perpok exits silently, as it is designed pri- marily for runscripts that might use it to perform simple depen- dency checks prior to starting their own services. This option causes perpok to print a message reporting either success or failure to stderr on exit. EXAMPLES perpok may be used as a basic dependency checking utility within ser- vice 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 immedi- ately. The perpd