LinuxCommandLibrary

initctl

Control Upstart jobs and services

SYNOPSIS

initctl [OPTIONS] COMMAND [JOB|EVENT] [KEY=VALUE...]
initctl status [JOB]
initctl list

PARAMETERS

--system
    Connect to the system Upstart init daemon (default).

--user
    Connect to the user Upstart init daemon, managing user-specific jobs.

--session
    Connect to the D-Bus session bus instead of the system or user bus.

--quiet
    Suppress most output from the command.

--no-wait
    Do not wait for job start/stop/restart/reload to complete before exiting. The command returns immediately.

start JOB [KEY=VALUE...]
    Starts the specified JOB. Optional KEY=VALUE pairs are passed as environment variables to the job process.

stop JOB
    Stops the specified JOB gracefully.

restart JOB [KEY=VALUE...]
    Restarts the specified JOB, effectively stopping it if running and then starting it again. Optional KEY=VALUE pairs are passed to the restarted job.

reload JOB
    Sends a SIGHUP signal to the main process of the specified JOB. This is typically used to make a service reload its configuration without fully restarting.

status [JOB]
    Displays the current status of the specified JOB (e.g., 'running', 'stopped', 'waiting'). If no JOB is provided, it lists the status of all known Upstart jobs.

list
    Lists all known Upstart jobs along with their current state (e.g., 'start/running', 'stop/waiting').

show-config JOB
    Displays the configuration details for the specified JOB, as defined in its .conf file in /etc/init/.

emit EVENT [KEY=VALUE...]
    Emits a custom EVENT to the Upstart init daemon. This can trigger other jobs that are configured to respond to this event. Optional KEY=VALUE pairs are passed as event arguments.

version
    Displays the version of the Upstart init system and the initctl utility.

log-priority PRIORITY
    Sets the minimum log priority for messages output by the Upstart init daemon. PRIORITY can be one of 'debug', 'info', 'warn', 'error', 'fatal', 'none'.

check-config
    Checks all Upstart job configuration files (.conf) for syntax errors and potential issues without modifying any services.

help
    Displays a help message with available commands and options for initctl.

DESCRIPTION

initctl is a command-line utility used to interact with the Upstart init system. It provides an interface to control and query the state of services and jobs managed by Upstart. Users can start, stop, restart, and check the status of specific jobs, or list all configured jobs.

While Upstart was primarily used in Ubuntu and some other distributions as an event-based replacement for the traditional System V init, it has largely been superseded by systemd in modern Linux distributions. However, initctl remains relevant for legacy systems still running Upstart.

It communicates with the Upstart init daemon (init(8)) via D-Bus to perform its operations, allowing for robust and dynamic service management based on system events.

CAVEATS

initctl is specific to the Upstart init system. It will not function on systems that use systemd (like modern Ubuntu, Fedora, Debian) or traditional System V init for service management. Operations affecting system services typically require root privileges (e.g., using sudo or being logged in as root). The behavior of initctl commands depends entirely on the definitions within the Upstart job configuration files (e.g., /etc/init/apache2.conf).

JOB CONFIGURATION

Upstart jobs are defined in plain text files with a .conf extension, typically located in the /etc/init/ directory. These configuration files specify a job's behavior, including when it should start (on which events), what command to execute, how to stop it, and how to handle respawning or pre-start/post-stop tasks. initctl interprets and acts upon these definitions, making the .conf files central to Upstart service management.

EVENT-DRIVEN SYSTEM

The core of Upstart's design is its event-driven nature. Instead of relying solely on runlevels, Upstart responds to events generated by the system, kernel, or even other jobs. For example, a job might be configured to start on filesystem and started networking. initctl emit allows administrators to manually generate these events, providing flexible control over service orchestration and custom workflows.

HISTORY

Upstart was developed by Canonical Ltd. for the Ubuntu distribution, first appearing as the default init system in Ubuntu 6.10 (Edgy Eft) released in 2006. It aimed to provide a more dynamic, event-driven replacement for the traditional System V init system, addressing shortcomings such as slow boot times and inability to handle asynchronous hardware events (e.g., hotplugging USB devices).

initctl served as the primary command-line interface to interact with the Upstart daemon throughout its tenure. Upstart was also adopted by other distributions, including RHEL/CentOS 6.x. However, with the rise of systemd, which offered similar and often more comprehensive features, Upstart's adoption waned. Ubuntu transitioned from Upstart to systemd starting with version 15.04 (Vivid Vervet) in 2015, marking the end of its widespread use as a default init system.

SEE ALSO

init(8), upstart(8), service(8), systemctl(1), runlevel(8)

Copied to clipboard