This repository explains how to automatically start the Ultroid Telegram bot using systemd
on Linux. With this setup, your bot will launch on every server reboot inside a detached screen
session.
git clone https://github.com/TeamUltroid/Ultroid
cd Ultroid
virtualenv -p /usr/bin/python3 venv
. ./venv/bin/activate
pip3 install --no-cache-dir -r requirements.txt
pip3 install --no-cache-dir -r re*/st*/op*.txt
screen -S Ultroid
nano .env
bash startup
Create a file named start-ultroid.sh
in the root directory:
nano /root/start-ultroid.sh
Paste the following:
#!/bin/bash
cd /root/Ultroid || exit
screen -dmS Ultroid bash -c "
source ./venv/bin/activate
bash startup
"
Then make it executable:
chmod +x /root/start-ultroid.sh
Create the systemd service file:
nano /etc/systemd/system/ultroid.service
Paste the following content:
[Unit]
Description=Ultroid Bot Auto Starter
After=network.target
[Service]
Type=oneshot
User=root
ExecStart=/root/start-ultroid.sh
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
Run the following commands to activate the service:
systemctl daemon-reexec
systemctl daemon-reload
systemctl enable ultroid.service
systemctl start ultroid.service
Done.
To reattach to the screen
session later:
screen -r Ultroid
๐ Disable auto-start on boot:
systemctl disable ultroid.service
This will prevent the service from starting on the next system boot.
โ Stop the service immediately:
systemctl stop ultroid.service
This will stop the currently running instance (if active).
๐งน (Optional) Remove the service completely:
If you want to fully remove the service file:
rm /etc/systemd/system/ultroid.service
systemctl daemon-reload