NITRO(8)

NAME
nitro - a tiny but flexible init system and process supervisior

SYNOPSIS
nitro [dir]

DESCRIPTION
nitro is a service supervisor that can be used as a Unix init system.

Every directory inside dir (by default: /usr/pkg/etc/nitro) defines a service.

When used as init, and the argument dir is ‘S’ or ‘single’, nitro looks at the directory /usr/pkg/etc/nitro.single instead. This can be used to boot into a special single-user mode.

SERVICE DIRECTORIES
Service directories must have a name shorter than 64 characters and must not contain ‘’, or newlines in the file name. Service directories cannot be nested.

Service directories can contain the following files:

setup
    If it exists, this script is run when starting the service, the service enters state SETUP. When setup exits with status 111, the service enters state FATAL. When setup exits with state 0, the service progresses to state STARTING. Else, setup is restarted after a delay.

run If it exists, this script should exec into the service. If this file does not exist, the service is a ONESHOT. When the service does not exit for 2 seconds, it enters state UP.

log If this is a symlink to another service directory, the standard output of the service is connected to the standard input of the target service using a pipe.

finish
    After the service has exited, this script is run with two arguments, the exit status of the service and the signal if the service exited due to a signal. Then, the service enters state DOWN.

down
    If this file exists, the service is not brought up automatically.

down-signal
    If this file exists, the first character of it encodes the signal (see nitroctl(1)) that is sent to the service to bring it down, else SIGTERM.

notification-fd
    If this file exists and contains a number, the service will be started having the file descriptor with this number connected to a pipe. Once the service is ready, it should write a newline to the pipe (and ideally close it). Other data can be written but is ignored, only the newline is relevant. Then nitro considers the service UP.

SOCKET CONFIGURATION
nitro uses a single Unix socket for control. The socket path is determined in the following way:

1.  The environment variable NITRO_SOCK, if it is set.

2.  The target of the symlink /usr/pkg/etc/nitro.sock, if that link exists.

3.  On Linux, /run/nitro/nitro.sock.

4.  On other operating systems, /var/run/nitro/nitro.sock.

FILES
The following special files are used inside the service directory:

SYS/setup
    This script is run very early in boot, before all services are started. It can already start services using nitroctl(1).

SYS/finish
    When system shutdown is requested, this script is run. When it exits, the remaining services are brought down.

SYS/reincarnate
    If this script exists, nitro execs into it instead of rebooting or shutting down.

SYS/final
    This script is run after all services are stopped. When it exits, the root file system is remounted read-only and the system shuts down/reboots.

EXIT STATUS
nitro tries hard not to exit, being used as pid 1.

SEE ALSO
nitroctl(1)

AUTHORS
Leah Neukirchen <leah@vuxu.org>