BotDC / termux_watch.sh
Gabeczkag's picture
File watcher hot-reload v4
753fd41
Raw
History Blame Contribute Delete
413 Bytes
#!/data/data/com.termux/files/usr/bin/bash
cd ~/BotDC || exit 1
LAST_MTIME=$(stat -c %Y bot.py 2>/dev/null)
while true; do
sleep 3
CURR_MTIME=$(stat -c %Y bot.py 2>/dev/null)
if [ "$CURR_MTIME" != "$LAST_MTIME" ]; then
echo "Wykryto zmiane w bot.py. Restartuje..."
pkill -f "python bot.py" 2>/dev/null
screen -dmS bot python bot.py
LAST_MTIME=$CURR_MTIME
fi
done