persistent process supervision
perpd(8)                persistent process supervision                perpd(8)

       perpd - persistent process scanner/supervisor/controller

       perpd [-hV] [-a secs ] [-g gid ] [ basedir ]

       perpd  scans a directory to start and monitor a collection of services.
       It is the principal daemon of an active perp installation.

       perpd operates on a base directory containing a  set  of  perpetrate(5)
       service  definitions.   The  base directory may be given by the basedir
       argument on the command line.  If no basedir argument is  given,  perpd
       will  look  for  a  value  associated  with  the environmental variable
       PERP_BASE.  If neither of these is defined, perpd  will  operate  on  a
       compiled-in default directory, normally /etc/perp.

       Service  definitions  are installed, configured and activated as subdi-
       rectories of the base directory.  As perpd sequentially scans the  base
       directory,  it looks for subdirectory names not beginning with `.'.  If
       perpd then finds the `sticky' bit set on the subdirectory, it considers
       the service definition ``active'' and attempts to start the service.

       First  perpd  inspects  the service subdirectory.  If the optional file
       named rc.log is present and executable, perpd spawns a child process to
       run  it,  setting up a pipe to link its stdin to the stdout of the main
       service.  To start the logging process, perpd invokes  rc.log  as  fol-

              ./rc.log start svname

       The  first  argument  is  the literal string ``start'', with the svname
       argument set to the basename of the subdirectory.

       After starting the optional logger, perpd proceeds  to  spawn  a  child
       process  to  run the required file named rc.main.  If a logging process
       has been defined as described above, perpd will also connect the stdout
       of the main service to the stdin of the logger.

       To start the main service, perpd invokes rc.main as follows:

              ./rc.main start svname

       The  conventions  and  arguments  for  starting rc.main are the same as
       those described for rc.log above.

       perpd runs each child process for rc.main and rc.log in a  new  session
       and separate process group.  The current working directory of the child
       process is set to the service subdirectory.  The environment  for  each
       process is defined with the variable PERP_BASE set to the absolute path
       of the perpd base directory as described above.

       The files rc.main and rc.log are known as ``runscripts''.   The  result
       of  running  ``start''  on  a runscript should normally be a persistent
       process, some long-running program designed to start at system boot and
       continue  running  until  system  shutdown.   Runscript conventions and
       examples may be found in the perpetrate(5) manual.

       perpd monitors its ``start'' processes to make sure they continue  run-
       ning.   If any active service process terminates, perpd is triggered to
       reset and restart the service.

       To reset a process that has terminated from  a  ``start'',  perpd  will
       invoke  the  associated  runscript  again  in  either one of two forms,
       depending on whether the process exited normally, or was  killed  by  a

              ./rc.main reset svname exit exitcode
              ./rc.main reset svname signal <