This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitdir.man
74 lines (74 loc) · 2.63 KB
/
initdir.man
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
.TH initdir 5
'''
.SH NAME
{/etc/initdir}/* - \fBinit\fR(8) service files.
'''
.SH DESCRIPTION
Service files provide an alternative to \fBinittab\fR(5) for
describing init process entries. Whereas inittab has one line
per entry in a single file, initdir uses one file for each entry.
.P
Init treats initdir entries as if they were appended to inittab, that
is, they are started last and stopped first. Unlike inittab, initdir
lacks any fixed entry ordering; in particular, entries are not sorted
by name.
.P
Service files are simple text files or shell scripts, possibly
containing \fIrunlevels\fR mask field similar to inittab lines.
The (base)name of the file stands for \fIname\fR field of the entry.
The \fIcommand\fR is either the contents of the file, or (in case of
executable shell scripts) the full file path.
.P
Initdir entries are always \fBS\fR-type.
See \fBinittab\fR(5) for detailed description of entry types and runlevels.
'''
.SH SYNTAX
There are two slightly different flavors of service files.
The first one is a plain file:
.P
.EX
\fB#:\fIrunlevels\fR
\fIcommand arg arg arg\fR ...
.EE
.P
which gets the same treatment as any \fBinittab\fR(5) line.
In particular, \fIcommand\fR is parsed and stored
the same way it is done with inittab entries.
.P
The second is a script (shell or otherwise):
.P
.EX
\fB#!\fIinterpreter\fR
\fB#:\fIrunlevels\fR
\fIinterpreter-code\fR
\fIinterpreter-code\fR
\fIinterpreter-code\fR
.EE
.P
Files or this kind must be executable, and init will use the full file
path as the command to run. Only \fIrunlevels\fR are parsed by init in this
case, the rest is left to \fIinterpreter\fR.
.P
In both cases, \fB#:\fIrunlevels\fR line may be omitted.
'''
.SH USAGE
Service files are meant primarily for package-managed systems as a easy
way to add managed init entries, as opposed to modifying inittab each time
a package is installed or uninstalled.
.P
Scripts may also be useful for daemons that need external initialization code.
.P
Whenever a script is used, it should typically end with an \fBexec\fR(3) call
or some equivalent thereof to replace \fIinterpreter\fR with the actual daemon
process. Leaving \fIinterpreter\fR running only makes sense if there is some
cleanup to do after the daemon dies.
'''
.SH COMPATIBILITY
Service files used by {INIT} are not compatible with SysV \fBinitscript\fR(5)s.
Typical initscript is expected to spawn a child process and return immediately,
similar to \fBdaemon\fR(3) behavior which they often use. In contrast, a service
script spawns (or execs) a foreground process and remains running until the process
dies.
'''
.SH SEE ALSO
\fBinit\fR(8), \fBtelinit\fR(8), \fBinittab\fR(5)