Skip to content

Restart Services

This page documents how to restart the live Magikal services and check they came back cleanly.

Services

Service Purpose
magikal-bot Live Discord bot
magikal-panel-api FastAPI backend for the web panel
magikal-panel-web Static frontend for the web panel

Before restarting

If you have changed files, check Git first.

Bot:

cd /home/magikalbot/magikal-bot
git status

Panel:

cd /home/magikalbot/magikal-panel
git status

Docs:

cd /home/magikalbot/magikal-docs
git status

Good output:

On branch master
nothing to commit, working tree clean

Restart the Discord bot

Restart:

sudo systemctl restart magikal-bot

Check status:

sudo systemctl status magikal-bot --no-pager

Good output should include:

Active: active (running)

Check recent logs:

sudo journalctl -u magikal-bot -n 100 --no-pager

Follow live logs:

sudo journalctl -u magikal-bot -f

Restart the web panel API

Restart:

sudo systemctl restart magikal-panel-api

Check status:

sudo systemctl status magikal-panel-api --no-pager

Good output should include:

Active: active (running)

Check recent logs:

sudo journalctl -u magikal-panel-api -n 100 --no-pager

Restart the web panel frontend

Restart:

sudo systemctl restart magikal-panel-web

Check status:

sudo systemctl status magikal-panel-web --no-pager

Good output should include:

Active: active (running)

Check recent logs:

sudo journalctl -u magikal-panel-web -n 100 --no-pager

Normal restart order

For bot-only changes:

sudo systemctl restart magikal-bot

For panel backend changes:

sudo systemctl restart magikal-panel-api

For panel frontend changes:

sudo systemctl restart magikal-panel-web

For full panel restart:

sudo systemctl restart magikal-panel-api
sudo systemctl restart magikal-panel-web

After restarting

Always check logs after a restart.

Bot:

sudo journalctl -u magikal-bot -n 100 --no-pager

Panel API:

sudo journalctl -u magikal-panel-api -n 100 --no-pager

Panel web:

sudo journalctl -u magikal-panel-web -n 100 --no-pager

Red flags

Investigate before continuing if you see:

  • failed
  • inactive
  • Traceback
  • ModuleNotFoundError
  • SyntaxError
  • database connection errors
  • Discord login/token errors
  • repeated restart loops

Safety rule

Do not keep editing after a bad restart.

Stop, check logs, identify the exact error, then fix one thing at a time.