blob: 644e6ec42164dd9b4efcdcc75be8b1a3cd86a238 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
Ninit is a very small program written as alternative init for
UNIX-like OS. It is a fork from minit.
SysVinit control the boot process and running daemons little. It set
default runlevel and start only gettys (ttyX are used rarely). The
hard work is done by hundreds of shell-scripts in /etc/rc.d/. Maybe
the right name of the program is "shell-init". Since there are
special tools to manage init-scripts all seems perfect.
Shell scripts are executed serially and as a result the boot process
is slowly. Maybe the big problems are lacking of dependences and
monitoring of the daemons. Who restart syslogd/sshd if they exit?
Which PID has sshd? DJB have a package daemontools which solves most
of the problems of init. Runit is another init which is based on
deamontools.
Ninit try to solve above problems. If compiled with dietlic
/sbin/ninit is only 4K and uses 16K memory. The program is mudular
like qmail. By needs ninit invokes some helper program to make a
task. All helpers uses approximately the same resources like ninit.
Only PID 1 is long-running daemon.
The main daemon start/stop/restart and monitor different programs.
Each program is a service which has a subdir in /etc/ninit/. The
configuration of a service are different files like qmail (not like
/etc/inittab). It stores all information for services in his memory.
Some of the benefits of ninit are:
start services and take dependencies (soft and hard) into account.
(re)start services (parallel).
start services in sync mode (serial).
wait services to finish (parallel).
boot on a completely read-only system (don't use /proc/ FS).
can start services without using any bash/sh interpreter!
easy stdin/stdout/stderr redirection to other service (log) or file.
does not use malloc/mmap/sbr (does all in stack space).
easy and reliable logging system (uses multilog or svlogd).
easy to restart/stop a service.
easy to get the service PID.
easy to change the service mode (respawn or not).
easy to list all services.
easy to add/remove a service.
easy to send signals to service.
easy to change UID/GID and environ of a service.
built-in softlimit (like in daemontools).
built-in simple cron (can restart service like cron).
automatic converter: /etc/inttab to services /etc/ninit/.
SysVinit emulator (ninit can listen on /dev/initctl).
small code size (the main daemon is 336 lines).
security guarantee (100 Euro).
There is a companion utility nsvc to comunicate with ninit over two
fifos. Ninit is compatible with minit and has many other features!
An ordinay user can use ninit to start/monitor his own services. It
have to set the variable NINIT_HOME and prepare a service directory.
In my opinion ninit is small, reliable, ready for production use.
|