depinit - manual page for depinit (depinit) version 0.1.4
Start and stop services.
Alternate configuration directory (default is
Messages sent to syslog. PRIORITY is one of
emergency, alert, critical, error, warning,
notice, warning, info, or debug.
Messages not sent to syslog (default if pid is not
Messages sent to stderr
Messages not sent to stderr (default if pid is 1)
File for stderr (default is /dev/console)
Give this help list
Give a short usage message
Print program version
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
depinit is a program for managing services, some of which can be provided by
daemons. Services can be started at boot time, or by an explicit command from
depctl. They can be stopped for shutdown and by an explicit command. Daemons
are automatically recreated if they die. Where possible the work is done in
parallel, limited by dependencies given in a configuration directory tree.
Depinit can be started as the init process (process id 1) or as an ordinary
process. Some of the defaults and the shutdown procedure change if depinit is
not process 1. As an ordinary process, depinit shuts down by killing any child
processes that it did not start, then it stops any process it did start. If
depinit is process 1, it then umounts everything except /dev and /proc.
Anything that cannot be unmounted is remounted read only. Loopback devices used
for mounts are detached, then the computer is switched off, halted, or rebooted
When started as process 1, depinit tells the kernel to send it the keyboard
signal, closes all file-decriptors, connects stderr to DEFAULT_ERROR_FILE,
catches SIGSEGV, and uses syslog facility daemon, (instead of user). Orphanned
processes are given parent process id 1, so depinit only does a proper job of
killing orphanned process for shutdown when it is process 1.
is set, it overrides the default configuartion directory
It does not override the command line.
is set, it overrides the default stderr file
It does not override the command line.
If this is set to '1', the kernel sends
to init when the
key is pressed.
The default value is '0'.
One directory per service to manage.
List of services, one per line that must have started before
this service can start. Also if
is explicitly told to
stop any service in this list, it will stop this service first.
Script to start a daemon.
If the script terminates,
Most daemons will fork off a process to provide the service,
Many will not do this if you use the correct options.
You must find these options to use the daemon with
assumes a daemon has started
if it runs for a certain amount of time.
stops daemons with
if they do not ignore that signal, otherwise
if they have a contolling terminal, and do not ignore
If that is no good, depinit will use SIGINT (if it is not ignored).
If none of the above are chosen, or if the daemon did not die promptly,
This choice of signals is also used for killing orphanned processes
'daemon', but stdin
is a pipe from another daemon.
The logical combination of a dest and a source.
'daemon', but stdout and stderr
are a pipe to another daemon (given in
If more than one daemon is mentioned in depend,
a separate pipe is opened for each,
starting at file descriptor 1.
Start script for a service.
Service is assumed to be started if
this script terminates with a result of 0.
If the service takes too long to start
while depinit is shutting down,
the service will receive
and if it does not die promptly,
If there is no
'daemon', 'source', 'dest', 'filter' or 'start' file,
assumes that a service has started if all its dependencies have started.
If a service was started with a start script, or no script at all,
will use the
script to stop it. If
is shutting down, and the
script takes too long to complete,
the process for the
script will receive
If it still takes too long,
it will receive
does not find a
script, it assumes no action is required to stop the service.
Default service to start when
If depinit crashes, it execs this file.
Bare in mind that
stdin, stdout, stderr,
and the signal masks will not be set up properly.
<configuration directory>/fifo /dev/initctl
This fifo is used by
to communicate with
is process 1, it uses
Otherwise it uses
will create it if it does not exits,
and if the filesystem is mounted rw.
Service to start when
receives the corresponding signal.
Default configuration directory.
Default file for stderr when depinit started as process 1.
If depinit is not process 1, stderr is not changed.
The kernel can be configured send
when you press the
key is normally <ctrl><alt><delete>,
but can be changed with
This is how
If depinit is process 1, start
if depinit is not process 1, this signal cannot be caught
and depinit exits without shutting down the services.
The kernel will send
to the init process each time you press the
key. If you want
to be run each time, make
end with "exec /sbin/depctl -k sig_quit".
If depinit is process 1, and it receives SIGSEGV, it logs a backtrace and execs
Toggles depinit's ability to start services and
Each of these starts the corresponding service eg
The idea for this program came from simpleinit by Peter Orbaek, Werner
Almesberger, Richard Gooch and Matthias Benkmann. Thanks also Dr D. J.
Bernstein. His software is like lego for the internet, just as much fun
to play with, and makes this program usable.
Written by Richard Lightman
Copyright 2002 Richard Lightman
This is free software; May be used and distributed under Version 2 of the GNU
public license see the source for copying conditions. There is NO warranty;
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.