xref: /illumos-gate/usr/src/cmd/initpkg/init.d/README (revision e4d060fb4c00d44cd578713eb9a921f594b733b8)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#ident	"%Z%%M%	%I%	%E% SMI"
23Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24Use is subject to license terms.
25
26NOTE: This directory contains legacy initialization and termination
27scripts for managing services.  The preferred method of service
28management is via the Service Management Facility; to read more about
29SMF, consult smf(5).
30
31File names in rc?.d directories are of the form [SK]nn<init.d filename>
32where 'S' means start this job, 'K' means kill this job, and 'nn' is the
33relative sequence number for killing or starting the job.  When
34executing each script in one of the /etc/rc[S0-6] directories, the
35/sbin/rc[S0-6] script passes a single argument.  It passes the argument
36'stop' for scripts prefixed with 'K' and the argument 'start' for
37scripts prefixed with 'S'.  There is no harm in applying the same
38sequence number to multiple scripts.  In this case the order of
39execution is deterministic but unspecified.  It is recommended that
40scripts be hard-linked from the same file stored in /etc/init.d/.
41
42On earlier Solaris releases, a script named with a suffix of '.sh' would
43be sourced, allowing scripts to modify the environment of other scripts
44executed later.  This behavior is no longer supported; for altering the
45environment in which services are run, refer to the SMF documentation.
46
47Legacy services are reported by the default svcs(1m) output, and (where
48appropriate) the utility's '-p' option.  This reporting assumes a
49behavior as described above, such that each 'S' script has a suitable
50matching 'K' script, and they are both hard linked to a script in
51/etc/init.d/.  If this is not the case, legacy service reporting may not
52operate accurately; under all circumstances, the scripts are always
53executed as described above.
54
55The run-levels operate as follows:
56
57s/S
58
59	Read /etc/rcS.d/README for details. This run-level corresponds to
60	the milestone svc:/milestone/single-user:default.
61
620/5/6
63
64	All /etc/rc0.d/K* scripts are run, followed by all /etc/rc0.d/S*
65	scripts. The S* scripts should only be used for cleanup during
66	shutdown.
67
681
69
70	If the system was in a higher run-level, all /etc/rc1.d/K* scripts
71	are run. Regardless of the previous run-level, all /etc/rc1.d/S*
72	scripts are run.
73
742
75
76	Read /etc/rc2.d/README for details. This run-level corresponds to
77	the milestone svc:/milestone/multi-user:default.
78
793
80
81	Read /etc/rc3.d/README for details. This run-level corresponds to
82	the milestone svc:/milestone/multi-user-server:default.
83
84