daemontools is a collection of tools for managing UNIX services.

supervise

supervise monitors a service. It starts the service and restarts the service if it dies. Setting up a new service is easy: all supervise needs is a directory with a run script that runs the service.

multilog

multilog saves error messages to one or more logs. It optionally timestamps each line and, for each log, includes or excludes lines matching specified patterns. It automatically rotates logs to limit the amount of disk space used. If the disk fills up, it pauses and tries again, without losing any data.

svstat

Usage:

svstat /service/name

/services/name consists of any number of arguments, each argument naming a directory. svstat prints one human-readable line for each directory, saying whether supervise is successfully running in that directory, and reporting the status information maintained by supervise.

svc

Syntax:

svc opts services

Usage:

svc -u /service/name
svc -u /service/name

opts is a series of getopt-style options. services consists of any number of arguments, each argument naming a directory used by supervise.

svc applies all the options to each service in turn. Here are the options:

-u: Up. If the service is not running, start it. If the service stops, restart it.
-d: Down. If the service is running, send it a TERM signal and then a CONT signal. After it stops, do not restart it.
-o: Once. If the service is not running, start it. Do not restart it if it stops.
-p: Pause. Send the service a STOP signal.
-c: Continue. Send the service a CONT signal.
-h: Hangup. Send the service a HUP signal.
-a: Alarm. Send the service an ALRM signal.
-i: Interrupt. Send the service an INT signal.
-t: Terminate. Send the service a TERM signal.
-k: Kill. Send the service a KILL signal.
-x: Exit. supervise will exit as soon as the service is down. If you use this option on a stable system, you're doing something wrong; supervise is designed to run forever.