<commit_before>==============================================================================
       Finit — A fast plugin-based /sbin/init with service monitoring
==============================================================================

Welcome to finit!

This is an extremely fast /sbin/init replacement with focus on small
embedded GNU/Linux systems.  Based on <NAME>'s original finit_
with I/O, service and hook plugin extensions.  The original was a
reimplementation of the EeePC fastinit_ daemon based on its system calls
with gaps filled with frog DNA.

In the world of finit we write C plugins that hook into and extend the
``main()`` loop of ``/sbin/init``, this is what gives the system its raw
performance and the user full control.

If you chose finit you know what you want, a fast no hassles boot!


Features
--------

**Service monitoring**
Restarting a service when it exits

**Plugins**
Extend and modify finit behavior. See examples in plugins/ directory.
Plugin capabilities:
   
* Service callbacks — should the service run/restart/stop?
* Task/Run callbacks — a one-shot command, should it run in sequence?
* Hooks — hook into the boot at predefined points to extend finit
* I/O — listen to external events and control finit behaviour/services

Most extensions and functionality not purely related to what an /sbin/init
needs to start a system from the original finit_ has been reactored into
plugins with either hooks or I/O demands.


/etc/finit.conf
---------------

Contrary to most script based init alternatives (`SysV init`_, upstart_,
OpenRC_ and the likes) finit instead reads its configuration from
``/etc/finit.conf``.  Below is a brief list, see the source code for the
full list:

check
    Run fsck on a file system before mounting it

module
    Load a kernel module, with optional arguments

network
    Script or program to bringup networking, with optional arguments

runlevel N
    N is the runlevel number 1-9, where 6 is reserved for reboot

run [RUN_LVLS] /path/to/cmd ARGS -- Optional description
    One-shot command to run in sequence when entering a runlevel, with
    optional arguments and description.  This command is guaranteed to
    be completed before running the next command.

task [RUN_LVLS] /path/to/cmd ARGS -- Optional description
    One-shot like 'run', but starts in parallel with the next command

service [RUN_LVLS] /path/to/daemon ARGS -- Optional description
    Service, or daemon, to be monitored and automatically restarted if
    it exits prematurely.  Please note that you often need to provide
    a --foreground or --no-background argument to most daemons to
    prevent them from forking off to the background.

runparts
    Call run-parts(8) on a directory other than the default /etc/finit.d

tty [RUN_LVLS] DEV
    Run getty on the listed TTY device, in the given runlevels

console DEV
    Some embedded systems have a dedicated console port. This command
    tells finit to not start getty, but instead print a friendly message
    and wait for the user to activate the console with a keypress before
    starting getty.

When running ``make install`` no default ``/etc/finit.conf`` will be
provided since the system requirements differ too much.  Try out the
Debian 6.0 example ``/usr/share/doc/finit/finit.conf`` configuration
that is capable of service monitoring SSH, sysklogd, gdm and a console
getty!


/etc/finit.d
------------

At the end of the boot, when networking and all services are up, finit
calls its built-in run-parts(8) on the ``/etc/finit.d/`` directory, if
it exists.  Similar to how the ``/ec/rc.local`` file works in most other
inits, only finit runs a directory of scripts.  This replaces the
earlier support for a ``/usr/sbin/services.sh`` script in the original
finit_.


Runlevels
---------

Support for runlevels_ is included in Finit from v1.8.  By default all
services, tasks, run commands and TTYs listed without a set of runlevels
get a default set [234] assigned.  The default runlevel after boot is 2.

To specify an allowed set of runlevels for a service, run command, task,
or tty, add [NNN] to it in finit.conf, like this:

        run     [S]      /etc/init.d/acpid start -- Starting ACPI Daemon
        task    [S]      /etc/init.d/kbd start -- Preparing console
        service [S12345] /sbin/klogd -n -x -- Kernel log daemon
        tty     [12345]  /dev/tty1
        tty     [2]      /dev/tty2
        tty     [2]      /dev/tty3
        tty     [2]      /dev/tty4
        tty     [2]      /dev/tty5
        tty     [2]      /dev/tty6

In this example acpid is started once at bootstrap using a conventional
SysV init script. Here the run command was used, meaning the following
task command is not run until the init script has fully completed.

Tasks and services are started in parallell, while run commands are run
in the order listed and subsequent commands are not started until a run
command has completed.

Existing finit.conf files that lack runlevel setting will get a default
runlevel assigned, [234].

Switching between runlevels can be done by calling init with a single
argument, e.g., 'init 5' switches to runlevel 5.


Rebooting and Halting
---------------------

Finit handles SIGUSR1 and SIGUSR2 for reboot and halt, and listens to
``/dev/initctl`` so standard Linux reboot and halt commands should also
work.


Building<commit_msg>Minor ReST syntax fix for improved display in GitHub<commit_after>==============================================================================
       Finit — A fast plugin-based /sbin/init with service monitoring
==============================================================================

Welcome to finit!

This is an extremely fast /sbin/init replacement with focus on small
embedded GNU/Linux systems.  Based on <NAME>'s original finit_
with I/O, service and hook plugin extensions.  The original was a
reimplementation of the EeePC fastinit_ daemon based on its system calls
with gaps filled with frog DNA.

In the world of finit we write C plugins that hook into and extend the
``main()`` loop of ``/sbin/init``, this is what gives the system its raw
performance and the user full control.

If you chose finit you know what you want, a fast no hassles boot!


Features
--------

**Service monitoring**
Restarting a service when it exits

**Plugins**
Extend and modify finit behavior. See examples in plugins/ directory.
Plugin capabilities:
   
* Service callbacks — should the service run/restart/stop?
* Task/Run callbacks — a one-shot command, should it run in sequence?
* Hooks — hook into the boot at predefined points to extend finit
* I/O — listen to external events and control finit behaviour/services

Most extensions and functionality not purely related to what an /sbin/init
needs to start a system from the original finit_ has been reactored into
plugins with either hooks or I/O demands.


/etc/finit.conf
---------------

Contrary to most script based init alternatives (`SysV init`_, upstart_,
OpenRC_ and the likes) finit instead reads its configuration from
``/etc/finit.conf``.  Below is a brief list, see the source code for the
full list:

check
    Run fsck on a file system before mounting it

module
    Load a kernel module, with optional arguments

network
    Script or program to bringup networking, with optional arguments

runlevel N
    N is the runlevel number 1-9, where 6 is reserved for reboot

run [RUN_LVLS] /path/to/cmd ARGS -- Optional description
    One-shot command to run in sequence when entering a runlevel, with
    optional arguments and description.  This command is guaranteed to
    be completed before running the next command.

task [RUN_LVLS] /path/to/cmd ARGS -- Optional description
    One-shot like 'run', but starts in parallel with the next command

service [RUN_LVLS] /path/to/daemon ARGS -- Optional description
    Service, or daemon, to be monitored and automatically restarted if
    it exits prematurely.  Please note that you often need to provide
    a --foreground or --no-background argument to most daemons to
    prevent them from forking off to the background.

runparts
    Call run-parts(8) on a directory other than the default /etc/finit.d

tty [RUN_LVLS] DEV
    Run getty on the listed TTY device, in the given runlevels

console DEV
    Some embedded systems have a dedicated console port. This command
    tells finit to not start getty, but instead print a friendly message
    and wait for the user to activate the console with a keypress before
    starting getty.

When running ``make install`` no default ``/etc/finit.conf`` will be
provided since the system requirements differ too much.  Try out the
Debian 6.0 example ``/usr/share/doc/finit/finit.conf`` configuration
that is capable of service monitoring SSH, sysklogd, gdm and a console
getty!


/etc/finit.d
------------

At the end of the boot, when networking and all services are up, finit
calls its built-in run-parts(8) on the ``/etc/finit.d/`` directory, if
it exists.  Similar to how the ``/ec/rc.local`` file works in most other
inits, only finit runs a directory of scripts.  This replaces the
earlier support for a ``/usr/sbin/services.sh`` script in the original
finit_.


Runlevels
---------

Support for runlevels_ is included in Finit from v1.8.  By default all
services, tasks, run commands and TTYs listed without a set of runlevels
get a default set [234] assigned.  The default runlevel after boot is 2.

To specify an allowed set of runlevels for a service, run command, task,
or tty, add [NNN] to it in finit.conf, like this::

  run     [S]      /etc/init.d/acpid start -- Starting ACPI Daemon
  task    [S]      /etc/init.d/kbd start -- Preparing console
  service [S12345] /sbin/klogd -n -x -- Kernel log daemon
  tty     [12345]  /dev/tty1
  tty     [2]      /dev/tty2
  tty     [2]      /dev/tty3
  tty     [2]      /dev/tty4
  tty     [2]      /dev/tty5
  tty     [2]      /dev/tty6

In this example acpid is started once at bootstrap using a conventional
SysV init script. Here the run command was used, meaning the following
task command is not run until the init script has fully completed.

Tasks and services are started in parallell, while run commands are run
in the order listed and subsequent commands are not started until a run
command has completed.

Existing finit.conf files that lack runlevel setting will get a default
runlevel assigned, [234].

Switching between runlevels can be done by calling init with a single
argument, e.g., 'init 5' switches to runlevel 5.


Rebooting and Halting
---------------------

Finit handles SIGUSR1 and SIGUSR2 for reboot and halt, and listens to
``/dev/initctl`` so standard Linux reboot and halt commands should also
work.


Building
{'fraction_non_alphanumeric': 0.09597840253211692, 'fraction_numerical': 0.007633587786259542, 'mean_word_length': 3.379535262943335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5152849', 'n_tokens_mistral': 3030, 'n_tokens_neox': 2872, 'n_words': 1517}