-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop-bot.sh
More file actions
executable file
·51 lines (39 loc) · 1.1 KB
/
stop-bot.sh
File metadata and controls
executable file
·51 lines (39 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Stop TikTok Bot Script
echo "🛑 Stopping TikTok Bot..."
echo ""
# Find and kill bot processes
PIDS=$(pgrep -f "node.*bot.js")
if [ -z "$PIDS" ]; then
echo "ℹ️ No bot process found running"
# Check for tmux session
if tmux has-session -t tiktok-bot 2>/dev/null; then
echo "Found tmux session 'tiktok-bot', killing it..."
tmux kill-session -t tiktok-bot
echo "✅ tmux session killed"
fi
exit 0
fi
echo "Found running bot process(es):"
ps aux | grep -E "node.*bot.js" | grep -v grep
echo ""
# Kill processes
echo "$PIDS" | xargs kill -15
sleep 2
# Check if still running
if pgrep -f "node.*bot.js" > /dev/null; then
echo "⚠️ Process still running, using force kill..."
echo "$PIDS" | xargs kill -9
sleep 1
fi
if pgrep -f "node.*bot.js" > /dev/null; then
echo "❌ Failed to stop bot"
exit 1
else
echo "✅ Bot stopped successfully"
# Also kill tmux session if exists
if tmux has-session -t tiktok-bot 2>/dev/null; then
tmux kill-session -t tiktok-bot
echo "✅ tmux session cleaned up"
fi
fi