1init.d(4)                        File Formats                        init.d(4)
2
3
4

NAME

6       init.d  -  initialization  and  termination  scripts  for changing init
7       states
8

SYNOPSIS

10       /etc/init.d
11
12

DESCRIPTION

14       /etc/init.d is a directory containing  initialization  and  termination
15       scripts  for changing init states. These scripts are linked when appro‐
16       priate to files in the rc?.d directories, where `?' is a single charac‐
17       ter  corresponding  to  the init state. See init(1M) for definitions of
18       the states.
19
20
21       The service management facility (see smf(5)) is the preferred mechanism
22       for  service  initiation and termination. The init.d and rc?.d directo‐
23       ries are obsolete, and are provided for  compatibility  purposes  only.
24       Applications  launched  from  these  directories  by svc.startd(1M) are
25       incomplete services, and will not be restarted on failure.
26
27
28       File names in rc?.d directories are of  the  form  [SK]nn<init.d  file‐
29       name>,  where  S means start this job, K means kill this job, and nn is
30       the relative sequence number for killing or starting the job.
31
32
33       When entering a state (init S,0,2,3,etc.) the rc[S0-6] script  executes
34       those  scripts  in /etc/rc[S0-6].d that are prefixed with K followed by
35       those scripts prefixed with S. When executing each script in one of the
36       /etc/rc[S0-6]  directories,  the  /sbin/rc[S0-6] script passes a single
37       argument. It passes the argument 'stop' for scripts prefixed with K and
38       the  argument  'start' for scripts prefixed with S. There is no harm in
39       applying the same sequence number to multiple scripts. In this case the
40       order of execution is deterministic but unspecified.
41
42
43       Guidelines  for selecting sequence numbers are provided in README files
44       located in the directory associated with that target state.  For  exam‐
45       ple,  /etc/rc[S0-6].d/README.  Absence  of a README file indicates that
46       there are currently no established guidelines.
47
48
49       Do not put /etc/init.d in your $PATH. Having  this  directory  in  your
50       $PATH  can  cause  unexpected behavior. The programs in /etc/init.d are
51       associated with init state changes and, under normal circumstances, are
52       not intended to be invoked from a command line.
53

EXAMPLES

55       Example 1 Example of /sbin/rc2.
56
57
58       When  changing  to init state 2 (multi-user mode, network resources not
59       exported), /sbin/rc2 is initiated by the  svc.startd(1M)  process.  The
60       following steps are performed by /sbin/rc2.
61
62
63           1.     In the directory /etc/rc2.d are files used to stop processes
64                  that should not be running in state  2.  The  filenames  are
65                  prefixed  with  K.  Each K file in the directory is executed
66                  (by /sbin/rc2) in alphanumeric order when the system  enters
67                  init state 2. See example below.
68
69           2.     Also  in  the  rc2.d  directory are files used to start pro‐
70                  cesses that should be running in state 2. As in Step 1, each
71                  S file is executed.
72
73
74       Assume  the  file  /etc/init.d/netdaemon is a script that will initiate
75       networking daemons when given the argument 'start', and will  terminate
76       the   daemons   if   given   the  argument  'stop'.  It  is  linked  to
77       /etc/rc2.d/S68netdaemon, and to /etc/rc0.d/K67netdaemon.  The  file  is
78       executed  by /etc/rc2.d/S68netdaemon start when init state 2 is entered
79       and by /etc/rc0.d/K67netdaemon stop when shutting the system down.
80
81

SEE ALSO

83       svcs(1), init(1M), svc.startd(1M), svccfg(1M), smf(5)
84

NOTES

86       Solaris now provides an expanded mechanism,  which  includes  automated
87       restart,  for  applications  historically  started  via the init script
88       mechanism. The Service Management Facility (introduced  in  smf(5))  is
89       the preferred delivery mechanism for persistently running applications.
90       Existing init.d scripts will, however, continue to be executed  accord‐
91       ing to the rules in this manual page. The details of execution in rela‐
92       tion to managed services are available in svc.startd(1M).
93
94
95       On earlier Solaris releases, a script named  with  a  suffix  of  '.sh'
96       would  be  sourced, allowing scripts to modify the environment of other
97       scripts executed later. This  behavior  is  no  longer  supported;  for
98       altering the environment in which services are run, see the setenv sub‐
99       command in svccfg(1M).
100
101
102       /sbin/rc2 has references to the obsolescent rc.d directory. These  ref‐
103       erences  are  for  compatibility  with old INSTALL scripts. New INSTALL
104       scripts should use the init.d directory for  related  executables.  The
105       same is true for the shutdown.d directory.
106
107
108
109SunOS 5.11                        17 Aug 2005                        init.d(4)
Impressum