-
Notifications
You must be signed in to change notification settings - Fork 373
/
fuxi_manage.sh
executable file
·47 lines (41 loc) · 969 Bytes
/
fuxi_manage.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
#!/bin/bash
APP_PATH=`dirname $0`
cd ${APP_PATH}
option=$1
[ -z "$option" ] && option=restart
start(){
nohup python3 ${APP_PATH}/fuxi_manage.py > ${APP_PATH}/logs/fuxi_http.log 2>&1 &
nohup celery worker -A fuxi_celery_worker.celery -B > ${APP_PATH}/logs/fuxi_celery.log 2>&1 &
}
stop(){
fuxi_flask=`ps -ef | grep "fuxi_manage.py" | grep -v "grep" |awk '{print $2}'`
fuxi_celery=`ps -ef | grep "fuxi_celery_worker" | grep -v "grep" |awk '{print $2}'`
for flask_pid in ${fuxi_flask}
do
kill -9 ${flask_pid}
done
for celery_pid in ${fuxi_celery}
do
kill -9 ${celery_pid}
done
sleep 2
}
case ${option} in
start)
echo "[*] Starting Now......"
start
echo "[*] Starting Finished"
;;
stop)
echo "[-] Stopping Now......"
stop
echo "[-] Stopping Finished"
;;
restart)
echo "[+] Restart Now......"
stop
start
echo "[+] Restart Finished"
;;
*)
esac