← back to flaviocopes.com

Systemd service generator

← All tools

Run your Node.js app (or any long-running command) as a proper Linux service: auto-restart on crashes, start on boot, logs in journalctl. Fill in the fields and copy the unit file plus the install commands.

~~~

Service

~~~

Output —

Unit files live in /etc/systemd/system/. After copying the file there, run sudo systemctl daemon-reload so systemd sees it, then enable --now starts it and hooks it into the boot sequence in one step. Logs go to the journal — read them with journalctl -u plus the service name.

~~~

What each directive does

~~~

About this tool

systemd is the init system on virtually every modern Linux distro, and a unit file is how you tell it "keep this process running". You get crash recovery, start on boot, centralized logs, and resource limits — all from one small config file, with nothing extra to install.

The popular alternative for Node.js apps ispm2, a process manager with a friendlier CLI, watch mode, and cluster support. pm2 itself still needs something to start it on boot — and that something is a systemd unit (that's whatpm2 startup generates). For a single app on a VPS, a plain systemd service like the one above is often all you need.

Everything runs in your browser — nothing you type leaves the page.

~~~

Read more