xref: /illumos-gate/usr/src/cmd/initpkg/init.d/README (revision bbf215553c7233fbab8a0afdf1fac74c44781867)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate# with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
22*bbf21555SRichard Lowe
237c478bd9Sstevel@tonic-gateCopyright 2004 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gateUse is subject to license terms.
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gateNOTE: This directory contains legacy initialization and termination
277c478bd9Sstevel@tonic-gatescripts for managing services.  The preferred method of service
287c478bd9Sstevel@tonic-gatemanagement is via the Service Management Facility; to read more about
29*bbf21555SRichard LoweSMF, consult smf(7).
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gateFile names in rc?.d directories are of the form [SK]nn<init.d filename>
327c478bd9Sstevel@tonic-gatewhere 'S' means start this job, 'K' means kill this job, and 'nn' is the
337c478bd9Sstevel@tonic-gaterelative sequence number for killing or starting the job.  When
347c478bd9Sstevel@tonic-gateexecuting each script in one of the /etc/rc[S0-6] directories, the
357c478bd9Sstevel@tonic-gate/sbin/rc[S0-6] script passes a single argument.  It passes the argument
367c478bd9Sstevel@tonic-gate'stop' for scripts prefixed with 'K' and the argument 'start' for
377c478bd9Sstevel@tonic-gatescripts prefixed with 'S'.  There is no harm in applying the same
387c478bd9Sstevel@tonic-gatesequence number to multiple scripts.  In this case the order of
397c478bd9Sstevel@tonic-gateexecution is deterministic but unspecified.  It is recommended that
407c478bd9Sstevel@tonic-gatescripts be hard-linked from the same file stored in /etc/init.d/.
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gateOn earlier Solaris releases, a script named with a suffix of '.sh' would
437c478bd9Sstevel@tonic-gatebe sourced, allowing scripts to modify the environment of other scripts
447c478bd9Sstevel@tonic-gateexecuted later.  This behavior is no longer supported; for altering the
457c478bd9Sstevel@tonic-gateenvironment in which services are run, refer to the SMF documentation.
467c478bd9Sstevel@tonic-gate
47*bbf21555SRichard LoweLegacy services are reported by the default svcs(1) output, and (where
487c478bd9Sstevel@tonic-gateappropriate) the utility's '-p' option.  This reporting assumes a
497c478bd9Sstevel@tonic-gatebehavior as described above, such that each 'S' script has a suitable
507c478bd9Sstevel@tonic-gatematching 'K' script, and they are both hard linked to a script in
517c478bd9Sstevel@tonic-gate/etc/init.d/.  If this is not the case, legacy service reporting may not
527c478bd9Sstevel@tonic-gateoperate accurately; under all circumstances, the scripts are always
537c478bd9Sstevel@tonic-gateexecuted as described above.
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gateThe run-levels operate as follows:
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gates/S
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate	Read /etc/rcS.d/README for details. This run-level corresponds to
607c478bd9Sstevel@tonic-gate	the milestone svc:/milestone/single-user:default.
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gate0/5/6
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gate	All /etc/rc0.d/K* scripts are run, followed by all /etc/rc0.d/S*
657c478bd9Sstevel@tonic-gate	scripts. The S* scripts should only be used for cleanup during
667c478bd9Sstevel@tonic-gate	shutdown.
677c478bd9Sstevel@tonic-gate
687c478bd9Sstevel@tonic-gate1
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gate	If the system was in a higher run-level, all /etc/rc1.d/K* scripts
717c478bd9Sstevel@tonic-gate	are run. Regardless of the previous run-level, all /etc/rc1.d/S*
727c478bd9Sstevel@tonic-gate	scripts are run.
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate2
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gate	Read /etc/rc2.d/README for details. This run-level corresponds to
777c478bd9Sstevel@tonic-gate	the milestone svc:/milestone/multi-user:default.
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gate3
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate	Read /etc/rc3.d/README for details. This run-level corresponds to
827c478bd9Sstevel@tonic-gate	the milestone svc:/milestone/multi-user-server:default.
837c478bd9Sstevel@tonic-gate
84