Buffl

Understaning Linux Startup: Post Kernel / Systemd

as
by abdullah S.

Unit File Sections:


[Unit] Section:



Directive

Purpose

Description=

Human-readable description

Documentation=

URLs for documentation

After=

Start after these units

Before=

Start before these units

Requires=

Hard dependency (fails if dependency fails)

Wants=

Soft dependency (continues if dependency fails)

Conflicts=

Cannot run with these units

Condition*=

Start only if condition is met

Assert*=

Assert condition or fail

[Service] Section:

Directive

Purpose

Type=

Service type (simple, forking, oneshot, notify, dbus, idle)

ExecStart=

Command to start service

ExecStop=

Command to stop service

ExecReload=

Command to reload service

Restart=

When to restart (no, on-success, on-failure, always)

RestartSec=

Wait time before restart

User=

User to run service as

Group=

Group to run service as

WorkingDirectory=

Working directory

Environment=

Environment variables

EnvironmentFile=

File with environment variables

StandardOutput=

Where to send stdout (journal, file, null)

StandardError=

Where to send stderr

PIDFile=

Path to PID file

TimeoutStartSec=

Timeout for starting

TimeoutStopSec=

Timeout for stopping

[Install] Section:

Directive

Purpose

WantedBy=

Target that wants this service

RequiredBy=

Target that requires this service

Alias=

Alternative names for unit

Also=

Additional units to enable/disable

Service Types:

Type

Description

Use Case

simple

Process doesn't fork (default)

Most services

forking

Process forks and parent exits

Traditional daemons

oneshot

Process exits after completion

Setup scripts

notify

Service sends notification when ready

Advanced services

dbus

Service acquires D-Bus name

D-Bus services

idle

Delays until all jobs are done

Low priority tasks


Author

abdullah S.

Information

Last changed