---
title: "PM2 vs systemd: keep your Node app always online on a VPS | StreetHosting"
description: "Compare PM2 and systemd for running a Node app in production: automatic restart, start on boot, logs and cluster mode. Learn when each one fits your VPS best."
url: "https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs"
type: "page"
language: "en-US"
---

VPS · 3 min · Intermediate

Published on Jun 17, 2026 · Updated on Jun 17, 2026

# PM2 vs systemd for your Node app

Your app needs to come back on its own after a crash and start together with the VPS. PM2 and systemd solve this in different ways. Here is how to set up each one and which to pick.

By [Equipe StreetHosting](https://streethosting.com.br/en/autores#equipe-streethosting) · StreetHosting infrastructure and support team

[Deploying and running apps](https://streethosting.com.br/en/guides/topics/deploy) [Monitoring and alerts](https://streethosting.com.br/en/guides/topics/monitoring) [Linux administration](https://streethosting.com.br/en/guides/topics/linux)

Summarize with:

[](https://chat.openai.com/?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fpm2-vs-systemd-nodejs.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "ChatGPT") [](https://claude.ai/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fpm2-vs-systemd-nodejs.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Claude") [](https://www.google.com/search?udm=50&aep=11&q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fpm2-vs-systemd-nodejs.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Google AI Mode") [](https://x.com/i/grok?text=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fpm2-vs-systemd-nodejs.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Grok") [](https://www.perplexity.ai/search/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fpm2-vs-systemd-nodejs.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Perplexity")

Share:

[](https://x.com/intent/tweet?text=PM2%20vs%20systemd%3A%20keep%20your%20Node%20app%20always%20online%20on%20a%20VPS&url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fpm2-vs-systemd-nodejs "Share on X") [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fpm2-vs-systemd-nodejs "Share on Facebook") [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fpm2-vs-systemd-nodejs "Share on LinkedIn") [](https://wa.me/?text=PM2%20vs%20systemd%3A%20keep%20your%20Node%20app%20always%20online%20on%20a%20VPS%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fpm2-vs-systemd-nodejs "Share on WhatsApp")

For agents: Copy as Markdown [.md](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs.md)

In this guide 5 sections

* [The problem they solve](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#o-problema)
* [PM2 in practice](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#pm2)
* [systemd in practice](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#systemd)
* [Comparison](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#comparacao)
* [How to choose](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#como-escolher)

Quick answer

To keep a Node app always online, use **PM2** or **systemd**. Both restart the process after a crash and start it on boot. PM2 is more convenient for Node and small teams. systemd integrates better with the system and handles many services. A common combination is PM2 managing the app and systemd starting PM2 on boot.

## The problem they solve[](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#o-problema)

Running the app straight from the terminal works until you close the session or the VPS reboots. Then everything goes down. A process manager fixes that: it keeps the app alive, restarts it on failure and brings it back after a reboot. It is a requirement for any [Node API in production](https://streethosting.com.br/en/guides/vps/host-nodejs-on-vps).

## PM2 in practice[](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#pm2)

PM2 is built for Node. With a few commands, it starts the app, configures restarts, shows logs and even runs in cluster mode to use multiple cores. It is the quick choice for anyone who wants to get a service up without digging into system files. The guide on [deploying a bot with PM2](https://streethosting.com.br/en/guides/discord-bots/deploy-discord-bot-pm2) walks through the full flow.

For PM2 to bring the app back after a reboot, run its startup command, which generates the systemd integration. Without that step, the app will not start on boot.

## systemd in practice[](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#systemd)

systemd is Linux's own service manager. You write a service file describing the command, the user and the restart policy. In exchange for a bit more configuration, you get full integration with the system, centralized logs and uniform control over every service on the machine.

Never run the app as root unless you have to. Set a dedicated user in the service to limit the damage if the app is compromised.

## Comparison[](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#comparacao)

| Criterion          | PM2             | systemd                 |
| ------------------ | --------------- | ----------------------- |
| Ease of use        | High for Node   | Requires a service file |
| Scope              | Focused on Node | Any service             |
| Cluster            | Built in        | Manual                  |
| System integration | Via startup     | Native                  |

## How to choose[](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#como-escolher)

* PM2 to quickly get one or a few Node apps running
* systemd to standardize many services on the machine
* Restart with a retry limit on both
* Start on boot configured and tested

There is no wrong choice: what matters is that the app comes back on its own. To host bots and services with low latency, check out the [bot plans](https://streethosting.com.br/en/bots) and the [Ryzen VPS](https://streethosting.com.br/en/vps/ryzen).

In this guide

* [The problem they solve](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#o-problema)
* [PM2 in practice](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#pm2)
* [systemd in practice](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#systemd)
* [Comparison](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#comparacao)
* [How to choose](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs#como-escolher)

## Frequently asked questions

Do PM2 and systemd do the same thing?

Partly. Both keep a process alive, restart it after a crash and start it on boot. PM2 is focused on Node and easy to use. systemd is the system manager and handles any kind of service.

Can I use both together?

Yes, it is common. You use PM2 to manage the app and configure systemd to start PM2 itself on boot. That gives you the convenience of PM2 with the reliability of systemd.

How do I avoid a restart loop?

Set a limit on attempts per time window. If the app crashes over and over because of a configuration error, restarting nonstop only makes things worse. The limit forces you to investigate instead of masking the problem.

Do I need this for a Discord bot?

Yes. A bot that does not restart on its own goes offline at the first failure. Both PM2 and systemd keep the bot up, as the guide on deploying a bot with PM2 shows.

Next step

See VPS plans

Root VPS in Brazil with NVMe and Anti-DDoS.

[See VPS plans](https://streethosting.com.br/en/vps)

[See Ryzen VPS Ryzen 9 9950X VPS in São Paulo with root access, NVMe and gamer Anti-DDoS.](https://streethosting.com.br/en/vps/ryzen) [See bot plans 24/7 Discord bots with fast activation and support in Portuguese.](https://streethosting.com.br/en/bots)

## Related guides

[VPS Intermediate How to host a Node.js app on a VPS in Brazil A Node.js app in production needs a process manager, a reverse proxy, HTTPS and automatic restarts. Follow the complete walkthrough on an Ubuntu VPS in São Paulo, close to your users and to Brazilian integrations. 9 min Read guide](https://streethosting.com.br/en/guides/vps/host-nodejs-on-vps) [Discord bots Intermediate Deploy a Discord bot with Node.js and PM2: env vars and auto restart PM2 is a popular Node process manager for Discord bots because it restarts after a crash, survives reboots when paired with the startup hook and centralizes basic logs without standing up a whole Kubernetes cluster. This guide covers the ecosystem file, env vars for the token and how it fits hosting in Brazil. 4 min Read guide](https://streethosting.com.br/en/guides/discord-bots/deploy-discord-bot-pm2) [VPS Intermediate How to schedule tasks on a VPS with cron A repetitive task you do by hand is a task you forget. Cron runs commands at fixed times: a backup overnight, a weekly cleanup, a scheduled restart. Here is how to set it up. 3 min Read guide](https://streethosting.com.br/en/guides/vps/schedule-tasks-vps-cron)

[← Back to the Guide Center](https://streethosting.com.br/en/guides)
