Open BafDyce opened 6 years ago
botamusique stop if disconnect (https://github.com/azlux/botamusique/blob/master/mumbleBot.py#L315) You need to use a systemd service or the debian packet supervisor to manage the restart.
Yeah, I was also thinking about just using a custom script for me personally. Nevertheless I think it would be a great feature to have in the bot itself, don't you think? :)
@BafDyce You can use the script to start the bot, with auto-restart in case of an error.
Example:
bot_stub.sh
#!/usr/bin/env bash
while [ 1 ]; do
echo "[$(date +%Y-%m-%d-%H%M%S)] Starting..."
#command to start a bot
sleep 5
echo "[$(date +%Y-%m-%d-%H%M%S)] Restarting..."
done
bot_start.sh
#!/usr/bin/env bash
cd "/path/to/bot"
screen -AmdS "bot" ./bot_stub.sh
please do a systemd service. I will write one in few days.
I personally use a Supervisor programm for now.
[program:bot]
command=/home/az/bot.py -s **** -u *****-c Channel
autostart=true
autorestart=true
startretries=10
startsecs=10
stopwaitsecs=5
user=azlux
For systemd I use :
[Unit]
Description=XANA
[Service]
ExecStart=/root/botamusique/mumbleBot.py -s mumble.*******.net -u XANA -c Bots
Restart=always
Type=simple
RestartSec=15s
WorkingDirectory=/root/botamusique
[Install]
WantedBy=multi-user.target
Currently when there's a connection issue between the bot and the connected mumble server (after successfully joining the server) the bot just quits. However, there are situations where it might be desired if the bot would try to reconnect:
In case the bot loses the connection to the server it should retry to connect a number of times (
n
) with some time (t
) delay between each connection retry.Each parameter should be configurable (command line and/or config file) with some meaningful default values if omitted.