Skip to content

Commit df33f42

Browse files
committed
🤶 Deeeploooooy
1 parent 2c3fd02 commit df33f42

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

‎.github/workflows/deploy.yml

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,30 @@ jobs:
2222
needs: [deploy-via-sftp]
2323
runs-on: ubuntu-latest
2424
steps:
25-
- name: Debug and Restart Bot via SSH
25+
- name: Restart Bot via SSH
2626
uses: appleboy/ssh-action@v0.1.10
2727
with:
2828
host: ${{ secrets.SERVER_IP }}
2929
username: root
3030
key: ${{ secrets.SSH_PRIVATE_KEY }}
3131
script: |
32-
echo "Step 1: Changing to /home/antbot/"
32+
echo "Changing to /home/antbot/"
3333
cd /home/antbot/
3434
35-
echo "Step 2: Activating virtual environment"
35+
echo "Activating virtual environment"
3636
source .venv/bin/activate
3737
38-
echo "Step 3: Checking Python version"
39-
python --version
40-
41-
echo "Step 4: Checking for existing bot process"
42-
ps aux | grep 'python main.py' | grep -v grep || echo "No existing bot process found"
43-
44-
echo "Step 5: Attempting to start bot"
45-
python main.py &
46-
echo $! > bot.pid
47-
echo "Bot start attempted, PID saved to bot.pid"
48-
49-
echo "Step 6: Waiting for 5 seconds"
50-
sleep 5
51-
52-
echo "Step 7: Checking if bot process is still running"
53-
if ps -p $(cat bot.pid); then
54-
echo "Bot is running with PID $(cat bot.pid)"
38+
echo "Checking for existing bot process"
39+
if pgrep -f 'python main.py'; then
40+
echo "Stopping existing bot process"
41+
pkill -f 'python main.py'
5542
else
56-
echo "Bot is not running. Check logs for errors."
43+
echo "No existing bot process found"
5744
fi
5845
59-
echo "Step 8: Checking bot log (last 20 lines)"
60-
tail -n 20 bot.log || echo "Failed to read bot.log"
46+
echo "Starting bot"
47+
python main.py &
6148
62-
echo "Step 9: Checking for any Python errors in syslog"
63-
grep python /var/log/syslog | tail -n 20 || echo "No recent Python errors in syslog"
64-
script_stop: true
49+
echo "Workflow completed"
50+
script_stop: true
51+
timeout: 60s

0 commit comments

Comments
 (0)