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.
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.
rc2 uses the following line to run the scripts in /etc/rc2.d:
/etc/prc_sync /etc/rc2.d 120 startIn this example, script processing is aborted after 120 seconds.
``Starting and stopping the system'' in Starting and stopping the system