What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Run your Discord bot under PM2, then connect PM2 to the VPS boot process and save the managed process list. PM2 will restart the Node.js process when it exits unexpectedly, keep it running after you close SSH, and bring it back after a server reboot.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
The essential sequence is: install PM2, start the bot with a stable name, verify it, run pm2 startup and execute the command PM2 prints, then run pm2 save. Use the same Linux user for normal PM2 commands and boot setup, especially when Node.js was installed with NVM.
As an Amazon Associate I earn from qualifying purchases.
What PM2 does for a Discord bot
PM2 is a process supervisor for Node.js applications. Instead of tying your bot to an interactive SSH shell, you give PM2 responsibility for the process. The PM2 daemon continues running after you disconnect, watches the bot, and can spawn a replacement when the process exits unexpectedly. PM2 describes this role as keeping an application alive across crashes and machine restarts.
There are two separate kinds of persistence to configure:
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
- Crash persistence: PM2’s normal autorestart behavior respawns a bot that terminates unexpectedly.
- Reboot persistence:
pm2 startupcreates an init-system integration, whilepm2 saverecords the processes that should be restored during boot.
A manual pm2 restart discord-bot is different from an automatic crash restart: it deliberately stops and starts the process, causing a short period in which the bot is unavailable.
Before you start
Use a VPS account that owns the bot
SSH into the VPS as the deployment user that should run the bot. PM2’s process list and saved dump belong to the account that ran PM2. Starting the bot as one user and configuring startup as another can leave the boot service looking in the wrong home directory.
If you intentionally need PM2 to manage another account, PM2’s startup command supports -u for the user and --hp for that user’s home path. Configure the process and save its list under the account that will own it.
Confirm Node.js, npm and the bot entry file
Your VPS needs a working Node.js installation and npm. Change to the directory containing the bot and identify its actual entry file; the examples below use index.js, but your project might start from another file or an npm script.
cd /path/to/your/discord-bot
node --version
npm --version
ls
Install the bot’s dependencies before handing it to PM2. If the project uses a package script rather than a direct file, use the PM2 command appropriate to that script; the direct-file procedure below assumes Node can launch the entry file itself.
Keep the Discord token out of published files
Supply the bot token through environment variables or another secret mechanism. Do not commit a token to a public ecosystem file, paste it into a screenshot, or place it in source code. The ecosystem example later includes a non-secret NODE_ENV value only; add your token through the secret arrangement used by your deployment.
Recommended Free Tools
Install PM2 and start the bot
-
Install PM2 globally with npm:
npm install --global pm2 -
From the bot directory, start the entry file and assign a stable process name:
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
pm2 start index.js --name discord-botReplace
index.jswith the real entry file. The namediscord-botis used by later status, log and restart commands, so keep it consistent. -
Check whether PM2 considers the process online:
pm2 statusThe process table should show the named application and its current state. An online state means PM2 has launched the process; it does not prove that the bot authenticated with Discord or that its event handlers are working.
-
Inspect output when the state is not online or the bot is not responding:
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.pm2 logs discord-bot pm2 monitpm2 logs discord-botfollows the application’s output and errors.pm2 monitprovides PM2’s local process-monitoring view. Read the first startup error before changing restart settings; a missing environment variable, dependency or permissions problem will otherwise become a restart loop.
Enable automatic startup after a VPS reboot
Starting a process in PM2 is not enough to restore it after the machine restarts. Complete both startup integration and process-list saving.
-
Ask PM2 to detect the VPS init system:
pm2 startup -
PM2 prints a command tailored to the detected system and usually requiring root privileges. Copy and run the exact command it prints. Do not substitute a command from a different machine or user; the generated command contains the account and paths PM2 needs.
-
Save the currently managed applications:
pm2 save
The startup hook runs during boot, and the saved dump tells it which applications to resurrect. Running pm2 save without first completing pm2 startup only writes the process list; it does not install the boot-time hook.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
Why the order matters
Start the bot before saving so the saved list contains the correct name, script and environment. If you later add, remove or rename a process, run pm2 save again so the boot copy matches the list you see with pm2 status.
NVM and Node.js upgrades
When Node.js is installed through NVM, its executable path can change after an upgrade. Re-run the PM2 startup setup after upgrading Node.js so the generated service points to the current Node and PM2 paths. Then verify the process and save the current list again.
Verify the service and perform an operational reboot check
Use these checks in order:
-
Confirm the process is present:
pm2 status -
Review recent application output:
pm2 logs discord-bot -
Check resource and process activity locally:
pm2 monit -
Reconnect to the VPS after a controlled reboot and run
pm2 statusandpm2 logs discord-botagain. This validates the complete path from the init hook to the saved process list and the bot’s own startup code.
A successful PM2 restart does not guarantee Discord availability. The bot still needs a valid token, the required Discord intents, network access and functioning application code. Treat PM2’s process state and the bot’s connection state as two different checks.
Choose restart behavior for crashes and failure loops
PM2’s default autorestart behavior is useful for a bot that occasionally exits, but a persistent code or configuration error can make it restart repeatedly. An ecosystem file lets you put restart policy, resource limits and environment settings in one versioned configuration.
Example ecosystem configuration
module.exports = {
apps: [{
name: "discord-bot",
script: "./index.js",
restart_delay: 4000,
max_restarts: 16,
max_memory_restart: "300M",
env: { NODE_ENV: "production" }
}]
};
Save this as ecosystem.config.js in the bot directory, adjust the script path and values to your application, and start it with:
pm2 start ecosystem.config.js --env production
After changing the ecosystem file or process definition, save the updated list:
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
pm2 save
What the main controls mean
| Setting | Purpose | How to choose it |
|---|---|---|
restart_delay |
Waits a fixed number of milliseconds before restarting after an exit. | Use a delay long enough for transient failures to clear and to avoid an immediate restart storm. The example uses 4,000 milliseconds. |
max_restarts |
Limits the number of restarts PM2 will attempt under the configured policy. | Set it according to how you want a repeatedly failing bot to surface for human attention. The example uses 16; it is not a universal value. |
max_memory_restart |
Restarts the process when its memory use reaches the configured threshold. | Choose a limit that fits the VPS and the bot’s normal working set. The example uses 300M. |
autorestart |
Controls whether PM2 automatically restarts the application after it exits. | Leave automatic restart enabled for a continuously running bot unless you have a deliberate reason to disable it. |
| Exponential backoff | Increases the delay between repeated crashes instead of retrying at one constant interval. | Use PM2’s exponential-backoff option when a bot’s dependency or external service needs progressively longer recovery intervals. |
The example values are starting points, not guarantees about capacity or reliability. A memory ceiling that is too low can cause healthy workloads to restart; a high restart limit can hide a broken release. Watch the logs and resource view while tuning.
Fixed delay versus exponential backoff
A fixed restart_delay gives predictable recovery time after an isolated crash. Exponential backoff is more appropriate when each restart is likely to fail again, because the wait grows between attempts and reduces rapid churn. Select one strategy based on the bot’s observed failure pattern rather than combining values blindly.
Diagnose the common failure cases
The bot stops when you close SSH
Check whether it was actually started by PM2. Run pm2 status after reconnecting. If the process is absent, start it with the PM2 command from the bot directory and then save the process list. If it is listed but stopped, inspect pm2 logs discord-bot for the application error instead of launching a second copy in the shell.
The bot restarts but never becomes usable
Repeated restarts usually indicate an application-level failure, missing configuration or an incompatible dependency. Read the earliest error in the PM2 log, correct that underlying problem, and restart once. Increasing max_restarts does not fix a bad token or a code exception; it only changes how long PM2 keeps retrying.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesThe process is online, but Discord shows it offline
PM2 only reports the Node.js process. Confirm that the token is available to the PM2 environment, that the bot requests the intents it uses, and that the startup log shows a successful login and ready event. A process can remain online while its Discord connection has failed or while its code is waiting indefinitely during initialization.
The process disappeared after reboot
Run pm2 status after reconnecting. If the list is empty, verify that you ran pm2 startup, executed the exact generated command, and then ran pm2 save. Also verify that all three operations used the same deployment user. A saved list under one account is not automatically restored for another account.
Startup broke after a Node.js upgrade
Re-run pm2 startup and execute the newly printed command so the boot integration uses the current Node and PM2 paths. Start or reload the bot with the updated runtime, check logs, and save the corrected process list.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Manual restarts create a visible outage
pm2 restart discord-bot intentionally stops and starts the process, so a brief interruption is expected. Schedule manual restarts when a short outage is acceptable and check the logs immediately afterward for authentication or migration errors.
Free tools Windows power users keep installed
One-click scans. No signup required.
Operate PM2 safely over time
Keep one authoritative process definition
Choose either the direct start command or the ecosystem file as the source of truth for the bot’s script, name and environment. Mixing ad hoc starts with an ecosystem-managed process can produce duplicate bot instances, conflicting names or a saved list that does not reflect the process you intended to run.
Save only deliberate changes
PM2’s saved dump is a boot-time instruction, not a live synchronization mechanism. Whenever you intentionally change the managed application set or its configuration, check pm2 status, review the logs, and then run pm2 save to persist that known-good state.
Protect logs and configuration
PM2 logs can include environment-derived values or error details. Restrict access to the deployment account and avoid logging the Discord token. Keep the ecosystem file free of secrets and ensure that any environment-file or secret mechanism used by the bot has permissions appropriate to its account.
Account for VPS resources
Memory limits and restart policies should reflect the VPS’s available resources and the bot’s normal workload. A limit that is too aggressive can create needless restarts; no limit at all can allow a memory leak to consume resources needed by the operating system or other services. Use pm2 monit and the application logs together when deciding whether a restart is caused by memory pressure or by a code failure.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Complete setup checklist
- SSH into the VPS as the intended bot owner.
- Change to the bot directory and confirm the real Node.js entry file.
- Install dependencies and keep the token outside public source or ecosystem files.
- Install PM2 with
npm install --global pm2. - Start the bot with
pm2 start index.js --name discord-bot, replacing the file name when necessary. - Confirm the process with
pm2 status. - Use
pm2 logs discord-botandpm2 monitto inspect startup and resource behavior. - Run
pm2 startupand execute the exact generated command. - Run
pm2 saveto persist the process list. - After any Node.js NVM upgrade, repeat the startup configuration.
- After ecosystem or process-list changes, verify the bot and run
pm2 saveagain. - Reconnect after a controlled reboot and verify both PM2’s state and the bot’s Discord connection.
When this setup is complete
Closing SSH no longer terminates the bot because PM2 owns the Node.js process. An unexpected process exit is handled by PM2’s restart policy, and a VPS reboot is handled by the boot integration plus the saved process dump. The dependable operating routine is to inspect pm2 status first, read pm2 logs when behavior is wrong, use pm2 monit for local resource visibility, and keep startup configuration aligned with the account and Node.js installation that actually run the bot.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




