]> pd.if.org Git - startuptools/blob - scripts/README
added startup scripts
[startuptools] / scripts / README
1 These scripts are intended to handle both boot time and
2 run-time management of system services and general configuration.
3
4 In general, the philosophy is to be as simple as possible.  The
5 admin who has to debug a boottime or service start up script
6 that he hasn't looked at in a year and a half and that was set
7 up by his predecessor anyway doesn't want something that can't
8 be understood with a basic knowledge of init, the shell, and
9 a couple of man pages.
10
11 A system administrators accumulated knowledge should also be
12 respected as far as possible.  There is no point in throwing
13 away years of experience merely for the sake of being different.
14 Further, the system should follow, as much as possible the
15 principle of least surprise.
16
17 Where possible, configuration scripts should be simple /bin/sh
18 compatible files that do nothing other than set variables
19 and do not call any programs.  This allows other scripts
20 to simply source them without any complicated parsing.
21
22 However, where existing tools use configuration files that don't adhere
23 to that principle, those files and tools should continue to be used
24 unchanged.  As examples, /etc/fstab, /etc/sysctl.conf.
25
26 In keeping with the above, these scripts work as follows:
27
28 Run-levels are little used, and so they will be kept to doing
29 as little as possible.  This system uses the following:
30
31 Run Level S: single user mode
32 Run Level 1: also single user mode
33 Run Level 2: multi user mode, but with as little running as
34 might be needed for maintaining the box.  Typically this
35 will be networking and sshd, but nothing else.  For some
36 systems even these may not be needed.
37
38 Run Level 3: This is the normal "everything running" level.
39 Run Level 6: System shutdown
40
41 No other run levels are used, though a system admin could
42 set them up if needed.
43
44 System Scripts
45 --------------
46
47 These scripts live in /etc
48
49 fstab: lists filesystems, this file is not changed from it's usual
50 format, and is used as such
51
52 rc.sysinit: done once at start time.  responsible for performing any
53 necessary early system initialization.  This reads rc.conf for some
54 of its actions
55
56 * do any boot time /tmp cleanup or similar
57 * fsck and mount filesystems
58 * load any kernel modules needed
59 * set the host name
60 * set up /dev (via udev on modern linux systems)
61 * sysctl
62 * do any utmp/wtmp initialization needed
63 * configure the console
64 * set timezone and clock
65
66 Since all of this has to be done before we do anything else,
67 and the order won't generally change, this can and should be
68 a single script.
69
70 rc.multi: brings up the system into multi user mode.  reads rc.conf
71
72 * start any startup scripts listed in DAEMONS
73
74 rc.conf:
75
76 responsible for setting variables used by other scripts.  this script will
77 be sourced by several other scripts and thus shouldn't actually perform
78 any actions of its own.  It can call other programs if needed to set variables,
79 but this should be minimized (e.g. it could cat /etc/hostname to set the HOSTNAME
80 variable, but shouldn't actually set the hostname, and it would be better to just
81 set the hostname directly)
82
83 DAEMONS: a set of scripts from /etc/rc.d/init.d to run.  These will
84 be run in the order listed.
85
86 HOSTNAME: the system hostname to set.
87
88 TZ: the system time zone
89
90 Robustness
91 ----------
92
93 Each daemon start-up script should register somehow the fact that it
94 is running and started.  A monitoring daemon then should be run *out of init*
95 to check these daemons and restart them if they crash.  If the monitor
96 is not run from init, it could itself crash.  This should perhaps be
97 run level 4 for this daemon.  Ideally, nothing would be run as a daemon
98 and init could handle the monitoring itself, but this would be a major
99 change to the usual practice.