What Is a systemd Service?
When you run your Python bot manually in an SSH terminal — python3 my_bot.py — it stops the moment you close the terminal or the Pi restarts. A systemd service is the production-grade solution: it runs your script in the background, completely detached from any terminal session, and handles three critical things automatically:
How the Generator Works
Fill in 7 fields above and click Download code (.sh). You get a personalised shell script that does everything in one step — no manual editing needed.
.sh file named install_yourbot.sh downloads to your computerHow to Find Your Virtual Environment
Not sure what your venv is called or where it lives? Every virtual environment contains a file called pyvenv.cfg — searching for this file is the most reliable way to find all venvs on your Pi.
Find ALL virtual environments in your home folder:
/home/admin/godbot_venv/pyvenv.cfg/home/admin/venv/pyvenv.cfgThe folder containing
pyvenv.cfg is your venv root. The Python binary is at that folder + /bin/python.
Find the exact Python path to paste into the generator:
/home/admin/godbot_venv/bin/pythonCopy this exact path into the Virtual Environment Python Path field above.
Quick visual check — list all folders in your home:
# Look for folders like: godbot_venv venv env .venv myenv
Confirm a folder is a valid venv and your packages are inside it:
ls ~/godbot_venv/bin/python && echo "Valid venv" || echo "Not found"
# Check your packages are inside it (replace with your package names)
/home/admin/godbot_venv/bin/python -c "import requests; print('requests OK')"
/home/admin/godbot_venv/bin/python -c "import pygame; print('pygame OK')"
sudo pip install or pip3 install without activating the venv first, they went into the system Python — not your venv. Always activate first (source ~/godbot_venv/bin/activate) before running pip install.
Finding Your File Paths on the Pi
Not sure what to enter for each field? Run these commands in your Pi's SSH terminal:
Find your Linux username:
whoami
Find your virtual environment Python path:
source ~/godbot_venv/bin/activate
which python
# Output example: /home/admin/godbot_venv/bin/python
python3. This is what replaces source activate for systemd.
Find your script's full path:
ls ~/alarm_host.py
realpath ~/alarm_host.py
# Output example: /home/admin/alarm_host.py
Verify the service will find your packages:
/home/admin/godbot_venv/bin/python -c "import sys; print(sys.prefix)"
# Should print: /home/admin/godbot_venv (confirms venv is active)
Where the Service File Lives
After running the installer, your service file is created at:
View its contents at any time:
Management Commands Cheat Sheet
Replace my_python_bot with your actual service name throughout.
Disabling and Removing a Service
Disable auto-start (keeps the service file, just stops it from running on boot):
Re-enable auto-start:
Completely remove the service (stop, disable, and delete the file):
sudo systemctl disable my_python_bot.service
sudo rm /etc/systemd/system/my_python_bot.service
sudo systemctl daemon-reload
sudo systemctl reset-failed
daemon-reload is required after deleting a service file. Without it, systemd still shows the old service in its cache.
Updating Your Script Without Reinstalling
After uploading a new version of your Python script to the Pi, just restart the service — no need to reinstall:
sudo systemctl restart my_python_bot.service
# Verify it came back up cleanly:
sudo systemctl status my_python_bot.service
The service file itself only needs to be recreated if you change the script path, venv, username, or boot delay. For those changes, generate a new installer from this page and re-run it — the installer safely overwrites the existing service file.
Troubleshooting
sudo journalctl -u my_python_bot.service -n 30 --no-pagerCommon causes: wrong venv path, wrong script path, or a Python import error in your script.
/home/admin/godbot_venv/bin/python -c "import sys; print(sys.prefix)" — it must print your venv path, not /usr.~/ or relative paths), and increase the boot delay if your script depends on network/WiFi being ready.Real Output — Confirmed Working
This is the actual terminal output from running the installer on a Raspberry Pi with the Hikvision Alarm Host script:
Installing service: my_python_bot Created symlink '/etc/systemd/system/multi-user.target.wants/my_python_bot.service' → '/etc/systemd/system/my_python_bot.service' ● my_python_bot.service - My Python Bot Service Loaded: loaded (/etc/systemd/system/my_python_bot.service; enabled; preset: enabled) Active: active (running) since Sun 2026-07-05 15:04:11 IST; 2s ago Process: ExecStartPre=/bin/sleep 30 (code=exited, status=0/SUCCESS) Main PID: 1504 (python) CGroup: /system.slice/my_python_bot.service └─1504 /home/admin/godbot_venv/bin/python /home/admin/alarm_host.py Jul 05 15:04:14 raspberrypi python[1504]: [INFO] Fetching DVR time for clock sync check... Jul 05 15:04:14 raspberrypi python[1504]: [INFO] Alarm host starting... Jul 05 15:04:14 raspberrypi python[1504]: [INFO] Connection attempt #1 — connecting to DVR... === Management Commands === Status: sudo systemctl status my_python_bot.service Logs: sudo journalctl -u my_python_bot.service -n 50 --no-pager Stop: sudo systemctl stop my_python_bot.service Restart: sudo systemctl restart my_python_bot.service Done! my_python_bot is running as a service.