Any application you deploy needs to stay running, restart automatically after a crash, and start on server boot. This guide compares the three most common ways to manage application processes on a VPS.
Quick Comparison
| Tool | Best For | Language Focus |
|---|---|---|
| PM2 | Node.js applications, easy cluster mode | Node.js-specific (but can run any command) |
| systemd | Any language, OS-native integration | Language-agnostic |
| Supervisor | Python applications, simple config syntax | Language-agnostic, popular in Python ecosystem |
PM2
Purpose-built for Node.js, with built-in log management, cluster mode for multi-core scaling, and a simple CLI.
pm2 start app.js --name myapp
pm2 startup
pm2 save
See How to Deploy a Node.js Application with PM2 and Nginx for the full guide.
systemd
Built into every modern Linux distribution — no extra installation needed. Works identically regardless of the application's language, and integrates natively with the rest of the OS (logging via journalctl, boot ordering, resource limits).
[Unit]
Description=My Application
After=network.target
[Service]
ExecStart=/usr/bin/node /opt/myapp/index.js
Restart=always
User=deploy
[Install]
WantedBy=multi-user.target
sudo systemctl enable --now myapp
See How to Manage Services with systemd and systemctl for full detail.
Supervisor
A popular Python-based process manager with straightforward INI-style configuration, common in Python/Django deployments (though it can manage any process).
sudo apt install supervisor -y
sudo nano /etc/supervisor/conf.d/myapp.conf
[program:myapp]
command=/var/www/myapp/venv/bin/gunicorn myproject.wsgi
directory=/var/www/myapp
user=deploy
autostart=true
autorestart=true
stderr_logfile=/var/log/myapp/err.log
stdout_logfile=/var/log/myapp/out.log
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start myapp
Which Should You Use?
- Node.js application? — PM2 is the most convenient, purpose-built option, especially for cluster mode
- Any other language, or want OS-native consistency? — systemd, since it requires no extra installation and works identically for every service on the system
- Python/Django team already using Supervisor conventions? — Supervisor remains a solid, well-documented choice
Common Features Across All Three
- Automatic restart on crash
- Start automatically on server boot
- Log capture and management
- Manual start/stop/restart control
Can You Mix Them?
Yes, but it's generally simpler to standardize on one process manager per server for consistency and easier troubleshooting, rather than mixing multiple approaches unnecessarily.
FAQ
Is systemd "better" than PM2 for Node.js?
Not necessarily — PM2 offers Node.js-specific conveniences (built-in cluster mode, simpler CLI for JS developers) that systemd doesn't provide natively; the choice is more about workflow preference than one being objectively superior.
Related Articles
- How to Manage Services with systemd and systemctl
- How to Deploy a Node.js Application with PM2 and Nginx
- How to Deploy a Django/Flask Application with Gunicorn and Nginx
