Copy · paste · systemctl enable --now

systemd unit files you can actually paste.

Complete .service, .timer, .mount, .path and .socket recipes for the things you actually configure — auto-restart a crashing service, run at boot, replace a cron job with a timer, auto-mount a share, watch a folder, socket-activate, and harden a service — each with the exact enable and verify commands.

18 recipes

Why this exists

You know systemd can do it. You don't remember the exact directive.

systemd runs services, schedules jobs, mounts filesystems, watches paths, and sandboxes processes — but the precise option (Restart=on-failure? OnCalendar= syntax? the .mount naming rule?) never sticks, so you re-read the man page or paste a half-right unit from a forum. unitforge.pages.dev is a library of focused, copy-paste unit files for real tasks, each with a one-line explanation, the enable/verify commands, and the gotchas (escaped mount names, enabling the timer not the service, network ordering).

How it works

Find the task, copy the unit, enable it

  1. Pick a recipe. Browse by unit type in the full recipe list.
  2. Copy the unit file into /etc/systemd/system/ (one-click copy on every block).
  3. Run daemon-reload then enable --now — each recipe gives the exact commands.

FAQ

Frequently asked questions

Are these systemd unit files free?

Yes. Every recipe on unitforge.pages.dev is free to read and copy, with no account, paywall, or sign-up. Some outbound links (for example to VPS hosting or Linux courses) may be affiliate links, which never change the price you pay.

Where do I put a unit file?

System units go in /etc/systemd/system/<name>.service (your own units; the distro's live in /lib/systemd/system). Per-user units go in ~/.config/systemd/user/. After adding or editing one, run "systemctl daemon-reload", then "systemctl enable --now <name>".

Do I need to be root?

For system units, yes — use sudo for daemon-reload, enable, start, and editing files under /etc/systemd/system. User units (systemctl --user, ~/.config/systemd/user/) need no root at all; enable lingering with "loginctl enable-linger $USER" if they should run after you log out.

Which systemd version do these target?

Modern systemd (v240+), which ships on current Debian/Ubuntu, RHEL/Fedora, Arch, and SUSE. A few directives (DynamicUser, some hardening and StartLimit options) are newer; where it matters the recipe notes it. Check yours with "systemctl --version".

What's the difference between enable and start?

"start" runs the unit right now (until reboot). "enable" sets it to start on every boot (but doesn't start it now). "enable --now" does both. For timers, sockets, paths, and automounts you enable the .timer/.socket/.path/.automount — not the .service it triggers.

Why use a systemd timer instead of cron?

Timers log every run to the journal (journalctl -u), show next/last run with "systemctl list-timers", can catch up missed runs (Persistent=true), depend on other units, retry, and jitter across a fleet (RandomizedDelaySec). cron does none of that. The "every 5 minutes" recipe is a drop-in replacement for a */5 entry.