Keep the bot online 24/7 and restart it automatically

What the panel does when your bot crashes, how to handle reconnects in code, and a nightly restart schedule.

1 min readUpdated 2026-09-14Diese Anleitung auf Deutsch lesen →

Crashes

If your process exits, the panel sees the server go offline. Enable crash detection to restart it automatically: it is on by default. When the process ends unexpectedly, the panel restarts it after a few seconds. If it crashes repeatedly within a short time, the panel stops trying and marks it crashed so you notice; fix the cause and start again.

Reconnects belong in your code

Discord disconnects gateways now and then. discord.js and discord.py reconnect on their own, as long as you do not catch the error and process.exit(). Do not wrap the client in a loop that restarts it; let the library handle it.

Memory leaks

A bot that grows to its RAM limit over days gets killed and restarted. A nightly restart hides the symptom: Schedules → cron 0 5 * * * → task Power action: restart. Better: find the leak (usually caches or event listeners added in a loop).

Watching it

The console shows your bot's output live. For alerts when it goes down, a simple approach is a status message your bot posts every hour in a private channel. If the message stops, you know. Kowalski can also tell you the current state and read the last crash.