LinuxCommandLibrary

systemctl-is-system-running

Report system's current running state

TLDR

Check whether the system is operational and print the current state

$ systemctl is-system-running
copy

Check and print the current state quietly (no output, only exit status)
$ systemctl is-system-running --quiet
copy

Wait until the boot process is completed before printing the current state
$ systemctl is-system-running --wait
copy

SYNOPSIS

systemctl [OPTIONS...] is-system-running

PARAMETERS

-q, --quiet
    Suppress all output to standard output, returning only the exit code.

--wait
    Wait until the system is fully up and running (i.e., 'running' or 'degraded') before exiting. This is useful for scripts that need to ensure the system is stable.

DESCRIPTION

The systemctl is-system-running command queries the systemd system and service manager for the current overall operational state of the system. This provides a high-level view of whether the system is fully initialized, running normally, experiencing issues, or in the process of shutting down.

It's a crucial tool for scripting, monitoring, and quick status checks, as it gives an immediate indication of the system's health from systemd's perspective. The command prints the state name to standard output and exits with a specific status code corresponding to that state. Possible states include "initializing", "running", "degraded", "maintenance", "stopping", "stopped", "offline", and "unknown".

A "running" state indicates that the system is fully operational and all critical services are active, while "degraded" signifies that some non-critical services might have failed, but the system remains largely functional. This command relies on the aggregated status of all active units and the overall system processes managed by systemd.

CAVEATS

While systemctl is-system-running offers valuable insight into the system's state from a systemd perspective, it has limitations. It only reflects the health of services and units managed by systemd; it does not account for application-level failures, network connectivity issues, or hardware problems not directly reported or managed by systemd. A system reported as 'running' could still have critical user-space applications malfunctioning or external network services unavailable. The 'degraded' state is subjective; a system in this state might still be perfectly functional for many tasks despite some service failures. States like 'initializing' or 'stopping' are inherently transient, and the output can change rapidly.

EXIT CODES

The command's exit code is a direct numerical representation of the reported system state, making it highly suitable for scripting and automation:
0: running
1: degraded
3: maintenance
4: stopping
5: stopped
6: initializing
7: offline
255: unknown (or other error)

OUTPUT FORMAT

When not used with the --quiet option, the command prints a single word to standard output, which is the name of the current system state (e.g., 'running', 'degraded', 'stopping').

HISTORY

The is-system-running verb is an integral part of the systemctl utility, which was introduced as the primary interface for the systemd system and service manager. systemd was developed as a modern replacement for the traditional SysVinit and Upstart systems, aiming to provide faster boot times, parallel service startup, and more robust process management. is-system-running was included from early versions of systemctl to provide a standardized, scriptable way to query the overall system health, a common requirement for automation, monitoring, and high-availability solutions in the systemd ecosystem. Its design reflects systemd's state-driven approach to system management.

SEE ALSO

systemctl(1), systemd(1), systemctl status, systemctl list-jobs

Copied to clipboard