Blog
3 min read

What Is systemd? Services, systemctl and journalctl for Beginners

systemd is the program that starts and manages services on most Linux servers. What it does, the systemctl commands to start, stop, restart and enable services, reading logs with journalctl, and how it keeps your app running after crashes and reboots.

systemd is the system and service manager on most Linux distributions — Ubuntu, Debian, Fedora and others. It's the first program the kernel starts, and it starts and looks after everything else: the web server, the database, SSH, and (if you set it up) your app. (What is Linux?)

Why you'll meet it

On a server, you want your app to:

  • start automatically when the server boots,
  • restart if it crashes,
  • keep its logs somewhere you can read them.

systemd does all three. Things it manages are called units; the ones that run programs are services (files ending in .service).

systemctl: controlling services

sudo systemctl status nginx      # is it running? recent log lines
sudo systemctl start nginx       # start now
sudo systemctl stop nginx        # stop now
sudo systemctl restart nginx     # stop and start
sudo systemctl reload nginx      # reload config without stopping (if supported)

sudo systemctl enable nginx      # start automatically on boot
sudo systemctl disable nginx     # don't start on boot
sudo systemctl enable --now nginx   # enable and start in one go

start affects now; enable affects future boots. Forgetting enable is why an app is mysteriously gone after a server restart.

List what's running, and what's broken:

systemctl list-units --type=service --state=running
systemctl --failed

Reading status

● myapp.service - My Node app
     Loaded: loaded (/etc/systemd/system/myapp.service; enabled)
     Active: active (running) since Thu 2026-10-01 09:12:44 UTC; 1 day ago
   Main PID: 1234 (node)
  • Loaded … enabled — the unit file exists and will start on boot.
  • Active: active (running) — it's up. Other values: inactive (stopped), failed (crashed and gave up), activating (starting or restarting).

journalctl: reading the logs

systemd captures everything services print to stdout/stderr in the journal:

journalctl -u myapp              # all logs for a service
journalctl -u myapp -f           # follow live
journalctl -u myapp -n 100       # last 100 lines
journalctl -u myapp --since "1 hour ago"
journalctl -b                    # everything since the last boot
journalctl -p err -b             # only errors since boot

When an app won't start, journalctl -u myapp -n 50 almost always shows why — a missing environment variable, a port in use, a crash. (How to read an error message)

Running your own app as a service

A minimal unit file at /etc/systemd/system/myapp.service:

[Unit]
Description=My Node app
After=network.target

[Service]
User=app
WorkingDirectory=/srv/myapp
ExecStart=/usr/bin/node server.js
Restart=always
EnvironmentFile=/srv/myapp/.env

[Install]
WantedBy=multi-user.target

Then:

sudo systemctl daemon-reload     # pick up the new/changed file
sudo systemctl enable --now myapp

Restart=always brings it back after crashes. For the full set of options — memory limits, hardening, graceful shutdown — see the systemd service file guide.

systemd vs PM2

PM2 is a Node.js-specific process manager that does similar things with a friendlier interface. systemd is built into the OS, works for any language, and needs nothing extra installed. (PM2 vs systemd)

Timers: systemd's cron

systemd can also run things on a schedule with timers, an alternative to cron with better logging. (Cron expressions explained)

Quick reference

Task Command
Is it running? systemctl status name
Start / stop / restart systemctl start / stop / restart name
Start on boot systemctl enable name
After editing a unit file systemctl daemon-reload
Logs journalctl -u name -f
What failed? systemctl --failed

EasySpawn keeps your apps running as managed services — restarted on crash and on reboot — with logs a click (or a Claude Code question) away. See how it works or join the waitlist.

Related: Writing a systemd Service File · PM2 vs systemd · Basic Linux Commands · Deploy a Node.js App to a VPS

Keep reading