CloudLinux.ro
Dev environments

How to create a systemd service for your app

Updated 7/20/2026

A systemd service keeps your app running, restarts it if it stops and launches it automatically at boot. It is the correct way to run production processes on Linux.

1. Create the service file

Create /etc/systemd/system/my-app.service:

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

[Service]
User=www-data
WorkingDirectory=/var/www/app
ExecStart=/usr/bin/node server.js
Restart=always
Environment="NODE_ENV=production"

[Install]
WantedBy=multi-user.target

2. Start and enable

systemctl daemon-reload
systemctl enable --now my-app

3. Check the status

systemctl status my-app
journalctl -u my-app -f

See the service logs, useful for debugging, see managing logs.

Advantages over running manually

  • Starts automatically after a server reboot.
  • Restarts itself if the app crashes (Restart=always).
  • Centralized logs through journalctl.

It works for Node, Python, Go apps or any process that must run continuously.

Put this guide into practice on your own VPS

EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.

See pricing

Related tutorials