startpar
Run System V init scripts in parallel
SYNOPSIS
startpar [-p <parallelism>] [-i <interval>] [-a <arg>] [-L <log_file>] <runlevel> <directory> [<service_file>]
PARAMETERS
-p <parallelism>
Sets the maximum number of scripts to run in parallel. The default value is typically 10.
-i <interval>
Specifies the interval (in milliseconds) between checking for completed processes. The default is usually 20ms.
-a <arg>
An additional argument to be passed to each script executed. This option can be used multiple times to pass several arguments.
-L <log_file>
Specifies a file to which logging messages will be appended. Useful for debugging startup sequences.
<runlevel>
The runlevel argument (e.g., "start", "stop", "restart") that will be passed as the first argument to each script executed.
<directory>
The directory containing the init scripts to be executed (e.g., /etc/rcS.d/
, /etc/rc2.d/
). startpar
will look for scripts prefixed with 'S' here.
<service_file>
Optional. If specified, only this specific script from the <directory> will be executed, rather than all 'S'-prefixed scripts.
DESCRIPTION
startpar
is a utility designed to accelerate the boot process of Linux systems that utilize the System V init system. It achieves this by executing multiple startup scripts concurrently, rather than sequentially.
When invoked, startpar
traverses a specified directory (typically an /etc/rcN.d/
runlevel directory), identifies scripts prefixed with 'S' (indicating "start"), and then executes a configurable number of these scripts in parallel. This significantly reduces the total time required for services to initialize and become available.
It's primarily used by the underlying init system during system startup or runlevel changes, not typically invoked directly by end-users. It passes the specified <runlevel> argument (e.g., "start" or "stop") to each script it executes.
CAVEATS
startpar
is an internal utility primarily used by the sysvinit
system (e.g., on Debian/Ubuntu derivatives). Direct manual invocation by users is rare and generally not recommended for managing services, as it bypasses higher-level service management tools. Its effectiveness is tied to the design of individual init scripts; not all scripts are safe to run concurrently, and improper use can lead to race conditions or system instability.
SCRIPT EXECUTION ORDER
startpar
identifies scripts in the specified directory that begin with 'S' (e.g., S01foo, S99bar). These scripts are sorted numerically and then alphabetically, and are executed in batches up to the configured parallelism limit, respecting their sorted order.
TYPICAL USAGE
This command is typically called by the init
process or associated scripts during system boot or runlevel changes. For instance, the /etc/init.d/rcS
script (which handles single-user mode or early boot services) might use startpar
to initialize early system services found in /etc/rcS.d/
concurrently.
HISTORY
startpar
was developed as part of the sysvinit-tools
package to address the slow boot times common in traditional System V init systems. Its introduction aimed to optimize system startup by leveraging the capability to run non-dependent services simultaneously, which was a significant improvement over strictly sequential execution. This parallelization feature was later more fully embraced and integrated into newer init systems like systemd
. startpar
remains relevant on systems still utilizing sysvinit
for service orchestration, providing a performance enhancement for their boot process.
SEE ALSO
init(8), service(8), update-rc.d(8), systemctl(1)