App 8: Build a Discord Bot / Build a Discord bot
Lesson 10 of 10
Keep it running
A bot only works while its program runs. Run it on an always-on machine like a home server with a systemd service, the same way Lazo Lab runs.
Key points
- systemd restarts it if it crashes
- Store the token in the service's environment
- Check logs with journalctl
[Service]
WorkingDirectory=/home/you/bot
Environment=DISCORD_TOKEN=...
ExecStart=/home/you/bot/venv/bin/python bot.py
Restart=alwaysYour turn
Run your bot as a service on an always-on computer.
Quiz · +10 XP
Why use systemd for a bot?
Log in to save progress and earn XP.