jlesage / minit

A small init and service supervisor suitable for Docker containers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Each service gets its own directory under /etc/minit (change this in the
source, it's a #define right at the start of minit.c).

Each service directory can contain the following files/symlinks:

  depends

    a plain text file containing a service name per line.
    Example: /etc/minit/sshd/depends could contain "network".
    Each of these services will be started before this service is
    started.  If you need to wait for static initializations to
    complete, use the sync flag.

  run

    a symbolic link to the program name.  No hard link, because argv[0]
    for the programs is created by extracting the part after the last
    slash in the contents of the symbolic link.
    Example: "/usr/bin/sshd" would be run with argv[0]="sshd".

  params

    a plain text file containing command line parameters for the
    service, one parameter per line.  No shell expansion is done.  If
    you need shell expansion, have run point to a shell script instead
    of the real daemon.  Note: Have the shell script exec the daemon
    instead of simply running it to save system ressources.

  respawn

    touch this file to make minit respawn the process when it dies.
    This should be touched for getty and network servers.

  sync

    touch this file to make minit wait until the service ends.  sync is
    mutually exclusive with respawn.  This is meant for static
    initializations like "ifconfig".

  log

    if this directory exists, it is taken as service and minit creates
    a pipe between stdout of this service and stdin of the log service.
    If the log service can not be started, this service will block if it
    writes to stdout.  File descriptors will be reused, i.e. if the log
    process dies and is restarted, no log entries will be lost and there
    will be no SIGPIPE.

Please see http://cr.yp.to/daemontools/multilog.html for a very good
logging tool.

minit will try to run the command line arguments as services.  The
kernel passes its arguments to init.  That means you can for example
have a service /etc/minit/sos-shell that starts a /bin/sh and then use
LILO to boot "bzImage sos-shell".  minit will then run that service.
If none of the services worked (or none were given), minit will spawn
the service "default".  The normal way to configure minit is to have
default be an empty service and just list all the services you want
minit to start at boot time in default/depends.

Other special services (besides "default") are "ctrlaltdel" and "kbreq".
ctrlaltdel will be run when the console user presses ctrl-alt-del and is
meant to reboot the computer.  kbreq is the keyboard request, which
can be mapped using loadkeys.  On my box, it is on Alt+Arrow-Up.  I use
it to shut down the computer.

About

A small init and service supervisor suitable for Docker containers

License:GNU General Public License v2.0


Languages

Language:C 77.2%Language:Roff 14.6%Language:Makefile 5.1%Language:Python 1.7%Language:Shell 1.4%