-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·56 lines (51 loc) · 1.15 KB
/
deploy.sh
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
52
53
54
55
56
#!/bin/bash
# weatherChatBot 프로그램 경로
BIN_PATH="./weatherChatBot"
# 로그 파일 경로
LOG_FILE="./weatherChatBot.log"
# PID 파일 경로
PID_FILE="./weatherChatBot.pid"
start() {
echo "Starting weatherChatBot ..."
nohup $BIN_PATH > $LOG_FILE 2>&1 &
echo $! > $PID_FILE
echo "weatherChatBot started with PID $(cat $PID_FILE)"
}
stop() {
if [ -f $PID_FILE ]; then
PID=$(cat $PID_FILE)
echo "Stopping weatherChatBot with PID $PID..."
kill $PID
rm $PID_FILE
echo "weatherChatBot stopped."
else
echo "PID file not found. Is the weatherChatBot running?"
fi
}
status() {
if [ -f $PID_FILE ]; then
PID=$(cat $PID_FILE)
if ps -p $PID > /dev/null; then
echo "weatherChatBot is running with PID $PID."
else
echo "weatherChatBot is not running, but PID file exists."
fi
else
echo "weatherChatBot is not running."
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
;;
esac