TidalVPS
Servers
โ˜Cloud VPSKVM servers from 2 to 24 vCores ๐Ÿ’ธBudget VPSOur Ripple plan for small projects ๐Ÿง High-memory VPS64 GB and 96 GB RAM plans ๐Ÿ’ฝStorage VPS500 GB to 10 TB, or add a disk ๐Ÿ›กDDoS protectionIncluded on every server
Operating systems
๐ŸงLinux VPSUbuntu, Debian, AlmaLinux, Rocky, Fedora ๐ŸŸ Ubuntu VPS22.04, 24.04 and 26.04 LTS ๐ŸŒ€Debian VPSDebian 12 and 13 ๐ŸชŸWindows VPSWindows Server 2019, 2022 and 2025 ๐ŸงฐcPanel & PleskControl panels, licence included
Locations
๐Ÿ‡บ๐Ÿ‡ธUnited States10 cities, East to West Coast ๐Ÿ“VirginiaUS East ๐Ÿ“OregonUS West
Canada, Europe & Asia-Pacific coming soon
Use cases
๐ŸŽฎGame servers โ›Minecraft hosting ๐Ÿค–Discord bots ๐ŸŒWordPress ๐ŸณDocker โš™n8n automations ๐Ÿ”’Personal VPN
All plans & pricing โ†’ DDoS protection & daily backups included on every server
Guides News Discord Log in Sign up

Guides ยท Oct 15, 2026

PM2 vs systemd for Discord Bots: Which Should You Use?

Compare PM2 and systemd for keeping a Discord bot online 24/7 on a VPS: restarts, boot start, logs, memory limits and when to pick each.

A Discord bot that runs in a terminal window dies when you close it. To keep it online around the clock on a Discord bot hosting VPS, you need a process manager that starts the bot on boot and restarts it after a crash. The two common choices are PM2 and systemd. Both work well; the right one depends on your language and habits.

Quick comparison

  • PM2 is a Node.js process manager. It is easy to install with npm, shows a live process table, and keeps logs per app. It is the natural choice for discord.js bots and other Node.js apps.
  • systemd is built into Ubuntu and Debian, so there is nothing to install. It works for any language (Python, Java, Go, Rust) and integrates with the system journal, resource limits and boot ordering.

If you run a mix of bots in different languages, using systemd for all of them keeps things consistent. If everything is Node.js, PM2 is quicker to work with day to day.

Option 1: PM2 for a Node.js bot

sudo npm install -g pm2
cd ~/mybot
pm2 start index.js --name mybot
pm2 save
pm2 startup

pm2 startup prints a command beginning with sudo env PATH=.... Copy and run that exact command, then run pm2 save again. After that the bot comes back on its own after a reboot.

Useful commands:

pm2 ls               # status table
pm2 logs mybot       # live logs
pm2 restart mybot    # restart after deploying new code
pm2 stop mybot       # stop it

To stop a runaway bot from eating all memory, add a limit: pm2 start index.js --name mybot --max-memory-restart 500M.

Option 2: systemd for any bot

Create a service file. This example runs a Python bot from a virtual environment as a normal user (replace alex and the paths with your own):

sudo nano /etc/systemd/system/mybot.service
[Unit]
Description=My Discord bot
After=network-online.target
Wants=network-online.target

[Service]
User=alex
WorkingDirectory=/home/alex/mybot
ExecStart=/home/alex/mybot/.venv/bin/python bot.py
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

For a Node.js bot, change ExecStart to something like /usr/bin/node index.js (find the real path with which node). Then load and start it:

sudo systemctl daemon-reload
sudo systemctl enable --now mybot
sudo systemctl status mybot
journalctl -u mybot -f

Restart=always brings the bot back after a crash, and enable starts it at boot.

Keep secrets out of your code

Store your bot token in an environment file instead of in the source. With systemd, add EnvironmentFile=/home/alex/mybot/.env to the [Service] section and restrict the file with chmod 600 .env. With PM2, read the token from a .env file in your code. Never commit tokens to a public repository; if one leaks, reset it in the Discord developer portal.

Common problems

  • The bot restarts every few seconds: read the logs. A bad token, a missing package or an unhandled error will cause a restart loop.
  • It works in the terminal but not as a service: services do not load your shell profile. Use full paths for the interpreter and set WorkingDirectory.
  • The bot gets killed for memory: check usage with free -h. A small swap file helps; see our swap guide.

Which one should you pick?

Pick PM2 if you only run Node.js bots and like its simple commands. Pick systemd if you want nothing extra to install, run non-Node bots, or want tight control over limits and startup order. Either way, follow the full walkthrough in how to host a Discord bot on a VPS, and secure the server first with our Ubuntu security checklist.

Frequently asked questions

Is PM2 or systemd better for a Discord bot?

Neither is strictly better. PM2 is simpler for Node.js bots, while systemd is built in and works with any language. Both restart a crashed bot and can start it at boot.

How do I keep a Discord bot running after I close SSH?

Run it under PM2 or a systemd service instead of in your terminal. Both keep running after you log out.

Do I need a VPS to host a Discord bot?

Not for a tiny test bot, but a VPS stays online 24/7, has no sleep timers, and lets you run several bots and a database on one server.

Where do I find my bot logs?

With PM2 use pm2 logs. With systemd use journalctl -u followed by your service name.

Related guides

  • How to Host a Discord Bot 24/7 on a VPS (Node.js & Python)
  • How to Deploy a Node.js App with PM2, Nginx and Free SSL
  • How to Add a Swap File on an Ubuntu VPS (and Tune It Properly)

Need a server for this?

Every TidalVPS VPS comes with full root access, unmetered traffic, daily backups and DDoS protection.

Buy a server Discord bot hostingNode.js hostingPython hosting
Hosting VPS hostingHigh-memory VPSExtra storageWindows VPSCheap VPSLinux VPSDocker VPSGame serversMinecraftDiscord botsWordPressn8n
Locations USA VPSVirginiaOregon
Resources AppsDiscord communityGuidesNewsPricingContact
Legal TermsPrivacyRefundsAcceptable useDMCAReport abuse
More VPS DDoS protected VPSUnmetered VPSUbuntu VPSDebian VPScPanel & Plesk VPSVPN VPS
Use cases Node.js hostingPython hostingTrading bot VPSSelf-hosting VPS
Popular guides Secure an Ubuntu VPSInstall DockerWireGuard VPNHost a Discord botMinecraft server
  Install WordPressDeploy Node.js with PM2Self-host n8nUpgrade Ubuntu 24.04 to 26.04Secure SSHHow DDoS protection worksGame server VPS size
ยฉ 2026 TidalVPS ยท Linux & Windows cloud VPS across the US