Keeping it running in the background
If you close the terminal or the SSH connection drops, the userbot stops. To keep it alive, run it inside screen, tmux or pm2. Choose just one option.
Always enter the project folder and activate the virtual environment before starting (step 4 of the installation). With pm2, the logo is shown without animation so it doesn't clutter the logs.
Option A: screen
sudo apt install -y screen # Arch: sudo pacman -S screenscreen -S kitdevsource venv/bin/activatepython3 -m kitdev
| Action | Command |
|---|---|
| Leave without stopping it | Ctrl+A and then D |
| Go back to the session | screen -r kitdev |
| List the sessions | screen -ls |
| Close the session | screen -X -S kitdev quit |
Option B: tmux
sudo apt install -y tmux # Arch: sudo pacman -S tmuxtmux new -s kitdevsource venv/bin/activatepython3 -m kitdev
| Action | Command |
|---|---|
| Leave without stopping it | Ctrl+B and then D |
| Go back to the session | tmux attach -t kitdev |
| List the sessions | tmux ls |
| Close the session | tmux kill-session -t kitdev |
Option C: pm2
pm2 needs Node.js. Install it together with pm2:
sudo apt install -y nodejs npm # Arch: sudo pacman -S nodejs npmsudo npm install -g pm2
From the project folder, start KitDev using the virtual environment's Python:
pm2 start "venv/bin/python -m kitdev" --name kitdev(On Windows the environment's Python is at venv\Scripts\python.exe.)
| Action | Command |
|---|---|
| View the logs | pm2 logs kitdev |
| View the status | pm2 status |
| Restart | pm2 restart kitdev |
| Stop | pm2 stop kitdev |
| Delete | pm2 delete kitdev |
To make it start by itself when the server boots:
pm2 savepm2 startup
pm2 startup prints a command; copy it, paste it and run it.