What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Run your bot from its project directory with PM2, then pair pm2 startup with pm2 save. PM2 supervises the Node.js process, starts it again when it exits unexpectedly, and restores the saved process list after a VPS reboot. The essential sequence is npm install --global pm2, pm2 start index.js --name discord-bot, pm2 startup (execute the exact command PM2 prints), and pm2 save.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What PM2 does for a Discord bot
A bot launched directly with node index.js belongs to your SSH session. Closing that session can end the process, and an unhandled failure leaves the bot offline until someone starts it again. PM2 is a process supervisor for Node.js: it keeps the bot process under management, respawns it after an unexpected exit using its default autorestart behavior, and can restore it when the machine boots.
As an Amazon Associate I earn from qualifying purchases.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallThere are two different kinds of restart to understand:
| Action | What happens | Availability impact |
|---|---|---|
| Automatic respawn | PM2 starts the process again after it exits unexpectedly. | Usually only the time needed to launch the process; repeated crashes can create a restart loop. |
pm2 restart discord-bot |
PM2 stops and starts the named process on request. | The bot is briefly unavailable during the stop/start cycle. |
| Boot restoration | The init integration created by pm2 startup launches the processes saved by pm2 save. |
The bot returns after a VPS reboot, provided the saved list and user environment are correct. |
PM2 documentation describes the goal as keeping an application alive through crashes and machine restarts. PM2 is not a Discord library and does not fix gateway, token, permission, or application-code errors; it supervises the process that runs your bot.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Before you install PM2
Have these items ready:
- SSH access to the VPS.
- The directory containing the bot’s entry file and its installed Node.js dependencies.
- The correct entry filename. The examples use
index.js; substitute the file your project actually starts. - A deployment user that will own and run the PM2 process. PM2’s process list is per user account.
- The bot token available through an environment variable or another secret mechanism, rather than in a public configuration file.
Change into the bot directory before starting it. Running PM2 from the wrong directory can point relative paths at the wrong place or start a different project than intended.
Set up a Discord bot with PM2
-
Connect to the VPS and enter the project directory
Open an SSH session and change to the directory that contains the bot entry file:
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.cd /path/to/your/discord-botUse your real deployment path. Confirm that the entry file exists before proceeding; for the example command below, that file is
index.js. -
Install PM2 globally
npm install --global pm2This installs the PM2 command for the Node.js environment used by the current account. If you use a Node version manager, install PM2 while the intended Node version is active and keep using the same account for subsequent PM2 commands.
-
Start the bot under PM2
pm2 start index.js --name discord-botReplace
index.jswith the actual entry file. The--name discord-botlabel gives you a stable name for status, logs, and restart commands.Rank #2
SaleSmart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
-
Check that PM2 sees the process
pm2 statusLook for the
discord-botprocess and its current state. A process listed by PM2 is not proof that the Discord connection is healthy, so continue with logs and the bot’s own application checks.DriversCrashes, No Sound, or Screen Glitches?PerformanceWindows Errors? Fix Them Before They SpreadDriversOutdated Drivers Are Slowing You DownSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Inspect output and resource activity
pm2 logs discord-botUse the named log command to see startup errors, authentication failures, or repeated exits. For a local live monitor, run:
pm2 monitPM2 documents
pm2 monitas its local process-monitoring view. Stop the live display according to your terminal’s normal interrupt behavior; the PM2 process itself continues running. -
Generate the boot integration command
pm2 startupPM2 detects the VPS init system and prints a command for installing the startup hook. The printed command commonly requires root privileges. Copy and run the exact command PM2 outputs; do not substitute a guessed service command, because the generated command contains the paths and account information for your system.
-
Save the current process list
pm2 saveThis writes PM2’s process-list dump. The boot hook created by
pm2 startupuses that dump to resurrect the bot after a machine restart.Free tools Windows power users keep installed
One-click scans. No signup required.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
-
Perform an operational check
Run
pm2 statusagain, reviewpm2 logs discord-bot, and verify from Discord that the bot responds as expected. A controlled VPS reboot is a sensible final check when you are able to schedule downtime; no reboot test is implied by this procedure, so treat it as an operator-run validation rather than an assumed result.
Why both pm2 startup and pm2 save are required
These commands solve different parts of the reboot problem:
| Command | Purpose | If you omit it |
|---|---|---|
pm2 startup |
Installs boot-time integration with the VPS init system and prints the command needed to enable it. | PM2 has no hook that runs at machine boot, even if a process is listed during your current SSH session. |
pm2 save |
Persists the currently managed process list for resurrection. | The boot hook may run without a current dump containing your bot, so the bot will not be restored. |
After adding, removing, renaming, or changing a managed process, run pm2 save again. Saving before starting the bot, or saving an old list after a deployment change, preserves the wrong state for the next reboot.
Make repeated crashes less disruptive
PM2’s default autorestart behavior is useful for one-off crashes, but a bot that fails immediately can restart continuously. An ecosystem file lets you define delays, limits, memory protection, and environment selection instead of relying only on the one-line start command.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →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 project. The values are an example, not universal requirements; choose them according to the bot’s failure pattern and the VPS resources available.
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
| Setting | Effect | How to choose it |
|---|---|---|
restart_delay |
Waits before restarting after an exit; the example waits 4,000 milliseconds. | Use a delay long enough for transient dependencies or rate limits, without hiding a genuine configuration error. |
max_restarts |
Limits the number of restarts; the example allows 16. | Set a finite ceiling when an endless crash loop would waste resources or obscure the root cause. |
max_memory_restart |
Restarts when memory usage exceeds the configured threshold; the example uses 300M. |
Base the threshold on the bot’s normal footprint and the VPS memory budget. |
autorestart |
Controls whether PM2 automatically restarts the process. | Keep automatic recovery enabled for a service that should remain online; disable it only for a deliberate operational reason. |
| Exponential backoff | Increases the wait between repeated crashes. | Use it when failures are persistent and a progressively slower retry pattern is preferable to a fixed delay. |
env |
Selects environment variables for the process; the example sets NODE_ENV to production. |
Put non-secret runtime configuration here, while keeping credentials outside a publicly readable file. |
Start the ecosystem file
pm2 start ecosystem.config.js --env production
After changing the ecosystem configuration, save the updated process definition:
pm2 save
If you change the script path, process name, restart policy, or environment selection but do not save, the next reboot can resurrect the previous definition instead of the one you are using now.
Keep the bot’s token out of public files
The Discord token is a credential. Keep it in environment variables or another secret mechanism and do not commit it to a public ecosystem file. The PM2 controls described here do not prescribe a particular secret manager, so select a method that fits your deployment and access model. If a token is exposed, rotate it through the appropriate Discord application controls and update the runtime environment before restarting the bot.
Review file permissions as well: the deployment user must be able to read the configuration at runtime, but unrelated users should not receive unnecessary access. Do not paste a live token into shell history, public issue trackers, or log output.
Use the right command for each maintenance task
| Need | Command | What to inspect |
|---|---|---|
| See whether PM2 manages the bot | pm2 status |
Name, state, restart count, and whether the process remains online. |
| Read recent application output | pm2 logs discord-bot |
Startup exceptions, missing modules, invalid configuration, and authentication errors. |
| Watch local process activity | pm2 monit |
Runtime activity and resource behavior while reproducing a problem. |
| Manually apply a restart | pm2 restart discord-bot |
Expect a short interruption while PM2 stops and starts the process. |
| Persist a changed process list | pm2 save |
Run after any intentional process or ecosystem change. |
Troubleshoot the common failure branches
The bot stops when you close SSH
- Check
pm2 status. If the bot is absent, it was likely never started under PM2; start the real entry file withpm2 start ... --name discord-bot. - If it appears but exits, inspect
pm2 logs discord-botfor an application or environment error. PM2 can restart a process, but it cannot correct a bad token, missing dependency, or code exception. - Do not use a separate foreground
nodecommand as the production process while expecting PM2 to supervise it. The process must be launched through PM2.
The bot works now but not after a VPS reboot
- Run
pm2 startupand execute the exact generated command, including any required elevated privileges. - Run
pm2 saveas the same deployment user that owns the bot process. - Check that you saved the current process list after the final configuration change. A saved list from an earlier deployment does not update itself.
PM2 starts, but the bot is missing after reboot
PM2’s saved list belongs to the account that ran PM2. If setup was performed as one user and the bot was started as another, the boot service can restore a different account’s list. Run the setup consistently as the deployment user. When configuring another user intentionally, PM2’s startup setup supports the -u and --hp options; use the target account and its home path rather than mixing users.
Best Value
The bot restarts endlessly
- Read
pm2 logs discord-botfirst and fix the underlying exception or configuration error. - Use an ecosystem file to add
restart_delay, capmax_restarts, or apply exponential backoff. - Set
max_memory_restartonly after considering the bot’s normal memory use and the VPS limit. - Do not treat a larger restart limit as a fix; it only permits more attempts before PM2 stops retrying.
The startup command points to an old Node.js installation
After upgrading Node.js under NVM, rerun the PM2 startup setup. The generated service must point at the current Node.js and PM2 paths; an older generated hook can continue invoking the previous installation. Start the bot with the intended Node version, regenerate the startup command, execute it, and save the process list again.
A manual restart causes a visible outage
pm2 restart discord-bot deliberately stops and starts the process, so a short interruption is expected. Schedule manual restarts when a brief disconnect is acceptable, and use logs afterward to confirm that the bot completed its login and initialization sequence.
A safe update workflow
- Connect as the same deployment user that owns the PM2 process.
- Change to the bot directory and apply the code or dependency update.
- Run the bot’s normal local validation before handing control back to PM2.
- Restart the managed process with
pm2 restart discord-bot, or start the ecosystem file if the process definition itself changed. - Check
pm2 statusandpm2 logs discord-botfor a clean startup. - Run
pm2 savewhenever the process list or ecosystem definition changed, so reboot restoration matches the deployed version.
Keep the restart policy proportional to the failure mode. A short fixed delay is often easier to reason about; exponential backoff is more appropriate when a repeatedly failing bot should make progressively less frequent attempts. Neither policy replaces correcting the code or configuration error shown in the logs.
Reboot validation checklist
When you can schedule a controlled maintenance window, validate the complete chain rather than checking only the current process:
- Before reboot:
pm2 statusshowsdiscord-botonline. - Before reboot:
pm2 logs discord-botshows a successful startup without a crash loop. - Before reboot: the latest intended process definition has been saved with
pm2 save. - After reboot: reconnect over SSH as the deployment user and run
pm2 status. - After reboot: inspect
pm2 logs discord-botand confirm the bot responds in Discord. - If it is absent: revisit the generated
pm2 startupcommand, the account used for setup, and the Node.js path after any NVM upgrade.
This validation checks boot integration, saved state, user ownership, runtime paths, and the bot’s own ability to connect; a green PM2 status alone does not verify Discord functionality.
The practical operating model
For a small VPS-hosted Discord bot, the reliable operating model is straightforward: launch the real entry file through PM2, use the named process for diagnostics and manual restarts, configure boot integration once, save the desired process list after every definition change, and investigate logs before increasing restart limits. PM2 provides supervision and recovery; your application code, credentials, Node.js installation, and Discord configuration still determine whether the bot can start successfully.
Recommended Free Tools
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.




