NEW 📢 Black Friday: our launch offer ends 30 Nov. Up to 70% off your first month on every game!See plans
Black FridayUp to 70% off your first month, ends 30 NovEnds in 9d 02h 53mBlack FridayUp to 70% off your first month, ends 30 NovEnds in 9d 02h 53mBlack FridayUp to 70% off your first month, ends 30 NovEnds in 9d 02h 53m

How to restart your Discord bot on a schedule

Discord bot hostingUpdated Oct 29, 20264 min read

Schedule the Send Restart task in Quick Tasks: open the Bot page, pane Restarts, click Open Quick Tasks, choose Schedule… on Send Restart, and set it to Every day at a quiet hour.

What already happens without a schedule

The Restarts pane shows Restart automatically if it crashes as On. If your bot stops by itself, it is started again within about a minute. You do not need a schedule for that. If it crashes again within a minute of being restarted, it is left stopped, and Console shows the banner Your bot stopped after crashing twice (or the banner for the cause, when the panel recognises it).

The Restarts pane of the Bot page: Restart automatically if it crashes marked On, and Restart every day at a set time with Open Quick Tasks.

Create a daily restart

  1. Open your bot server in the panel, then the Bot page, pane Restarts, and click Open Quick Tasks. You can also open Quick Tasks from the menu.
  2. Under All tasks, find Send Restart ("Gracefully restarts the server container."). The Search box helps.
  3. Open its menu (the three dots) and choose Schedule….
  4. In Schedule task, give it a Name, for example Nightly restart, and click Next step.
  5. Choose Repeats, set How often to Every day and At to a quiet hour, for example 04:00. The line under it says when it runs, and what time that is where you are.
  6. Leave Enabled on and click Schedule.

The Schedule task dialog on its Time step with Repeats, Every day and a time of 04:00 chosen for Send Restart.

The new schedule appears under Schedules, with its next run time. Its switch turns it on and off; its menu has Run now to test it once. The whole page is explained in How to schedule tasks and automatic backups.

Back up before the restart

If your bot keeps data in files, such as a SQLite database or JSON files, add a backup before the restart. A task you drag onto a schedule is added as its last step, so build it the other way round: choose Schedule… on Backup Server first, then drag Send Restart from All tasks onto that schedule. Steps run in order. A backup holds your server's files; it does not hold your token, your environment variables or a database from the Databases page. See How to create, download and restore backups.

When a scheduled restart helps

  • Memory slowly climbs until the bot is stopped for using too much. A daily restart resets it while you look for the leak.
  • You deploy from Git with Update on every start on: a nightly restart picks up what you pushed during the day. See How to deploy and update your Discord bot from GitHub.
  • Packages install again once a day even when nothing changed, so regular restarts also bring in new versions allowed by your package file.

When it does not

A restart hides a problem; it does not solve it. If your bot needs one every few hours, read the console just before it stops: Why your Discord bot keeps stopping.

Already hosting your bot somewhere else? Move it to us

OUR LATEST BLOGS