-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot
36 lines (30 loc) · 900 Bytes
/
bot
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
#!/bin/bash
SESSION_NAME="miyoko-pfx-bot"
if [[ "$1" == "--stop" ]]; then
if screen -list | grep -q "$SESSION_NAME"; then
screen -S "$SESSION_NAME" -X quit
echo "🛑 Bot stopped."
else
echo "❌ No running session found for '$SESSION_NAME'."
fi
exit 0
fi
if [[ "$1" == "--attach" ]]; then
if screen -list | grep -q "$SESSION_NAME"; then
screen -r "$SESSION_NAME"
else
echo "❌ No running session found for '$SESSION_NAME'."
fi
exit 0
fi
if screen -list | grep -q "$SESSION_NAME"; then
echo "⚠️ A session '$SESSION_NAME' already exists. Please terminate it or choose a different name."
exit 1
fi
screen -S "$SESSION_NAME" -d -m uv run src/bot.py
if [[ $? -eq 0 ]]; then
echo "✅ Bot started in the background in screen session '$SESSION_NAME'."
else
echo "❌ Failed to start the bot."
exit 1
fi