DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

prc_sync(ADM)


prc_sync -- run startup and shutdown scripts

Syntax

/etc/prc_sync [-x] directory timeout start | stop

Description

prc_sync runs startup and shutdown scripts in parallel or serially, and controls their execution sequence. The scripts are expected to be found in directory.

prc_sync runs scripts in the order of their filenames, sorted according to the ASCII collation sequence from their second character onwards (see rc2(ADM) for more details). Scripts starting with the letters ``S'', ``K'', or ``I'' are executed serially; those beginning with ``P'' are executed concurrently if they form a contiguous sequence between ``S'', ``K'', or ``I'' scripts. Processing of an ``S'', ``K'', or ``I'' script does not start until all previous scripts have completed.

If a single ``S'' or ``K'' script, or a multiple set of ``P'' scripts do not complete within timeout seconds, prc_sync moves on to process the next ``S'', ``K'' or ``I'' script or set of ``P'' scripts in sequence. If an ``I'' script is being processed, timeout is ignored and the script runs to completion regardless of time. The final argument to prc_sync can take the value start or stop; this is passed as the first argument to each script in directory.

The scripts directory must contain a sub-directory called messages. All output generated by a script on the standard output and standard error output is sent to directory/messages/script.log. The contents of this file are not displayed on the console until the script exits. The exceptions to this rule are ``I'' scripts where input and output is taken from stdin and stdout; stdout is usually the system console. This allows the script to read input from the keyboard such as a request to mount filesystems during startup.

The status of script processing is written to the file directory/messages/prc_sync.

Exit values

prc_sync exits with a value of 0 on successful completion; if an error occurs, it exits with a value of 1.

Scripts should exit with a value of 0 on successful completion; otherwise, they should exit with a non-zero value.

Scripts are run with the Bourne shell using a command of the form:

/bin/sh directory/script [-x] [start | stop]

The script files do not have to be executable. Therefore, to disable an rc script, you must either move it out of its directory or rename it so that it does not start with the letters ``S'', ``K'', ``I'', or ``P''.

If prc_sync is used the -x option, the flag is passed to the shell with which the scripts are started. The -x flag turns on the shell's command tracing feature, which can be helpful in debugging script problems.

Examples

The rc0(ADM) and rc2(ADM) scripts use prc_sync to run the scripts in the directories /etc/rc0.d and /etc/rc2.d. These scripts halt the system (put it in run level 0) or put the system in multiuser mode (run level 2).

rc2 uses the following line to run the scripts in /etc/rc2.d:

   /etc/prc_sync /etc/rc2.d 120 start
In this example, script processing is aborted after 120 seconds.

Warning

prc_sync is intended to be run by startup and shutdown programs only. It should never be executed directly from the command line.

Files


directory/messages/script.log
contains output generated on standard output/error by a script

directory/messages/prc_sync
contains status of script processing

See also

init(M), rc0(ADM), rc2(ADM), shutdown(ADM)

``Starting and stopping the system'' in the SCO OpenServer Handbook

Standards conformance

prc_sync is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003