CI: v25 - Fixed pkill with timeout, proper paths
Some checks are pending
BotServer CI / build (push) Waiting to run

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-18 20:44:04 -03:00
parent 6f003a313c
commit c218556a94

View file

@ -1,4 +1,4 @@
# v24 - Deploy with traces # v25 - Deploy: fixed pkill, correct paths
name: BotServer CI name: BotServer CI
on: on:
@ -26,30 +26,27 @@ jobs:
run: | run: |
cd /opt/gbo/work/botserver cd /opt/gbo/work/botserver
cargo build -p botserver cargo build -p botserver
ls -lh target/debug/botserver
- name: Deploy - name: Deploy
run: | run: |
echo "Deploy step 1/4: Stopping..." echo "1. Kill old..."
sudo pkill -f botserver || true timeout 5 bash -c 'while pgrep -x botserver > /dev/null; do pkill -x botserver; sleep 0.5; done' || true
sleep 1
echo "Deploy step 2/4: Copying..." echo "2. Copy binary..."
cp -f /opt/gbo/work/botserver/target/debug/botserver /opt/gbo/bin/botserver mkdir -p /opt/gbo/bin
cp -f /opt/gbo/work/botserver/target/debug/botserver /opt/gbo/bin/
chmod +x /opt/gbo/bin/botserver chmod +x /opt/gbo/bin/botserver
echo "Deploy step 3/4: Starting..." echo "3. Start new..."
cd /opt/gbo/bin cd /opt/gbo/bin
nohup ./botserver --noconsole > /opt/gbo/logs/stdout.log 2>&1 & ./botserver --noconsole &
BOT_PID=$!
echo "Started PID: $BOT_PID"
echo "Deploy step 4/4: Verifying..."
sleep 3 sleep 3
if pgrep -f botserver > /dev/null; then
echo "✅ Success - botserver running" echo "4. Verify..."
pgrep -f botserver if pgrep -x botserver > /dev/null 2>&1; then
echo "✅ Running: $(pgrep -x botserver)"
else else
echo "❌ Failed - botserver not running" echo "❌ Not running"
cat /opt/gbo/logs/stdout.log | tail -10
exit 1 exit 1
fi fi