forked from china-testing/python-api-tesing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshutdown.sh
More file actions
executable file
·42 lines (38 loc) · 1.21 KB
/
shutdown.sh
File metadata and controls
executable file
·42 lines (38 loc) · 1.21 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
#!/bin/sh
# Author: xurongzhong#126.com wechat:pythontesting qq:37391319
# CreateDate: 2018-02-08 qq群: 144081101
# shutdown.sh
APP_MAIN=older.py
PID=0
getPID(){
pythonps=`ps aux | grep $APP_MAIN | grep -v grep`
if [ -n "$pythonps" ]; then
PID=`echo $pythonps | awk '{print $2}'`
else
PID=0
fi
}
shutdown(){
getPID
echo "================================================================================================================"
if [ $PID -ne 0 ]; then
echo -n "Stopping $APP_MAIN(PID=$PID)..."
kill -9 $PID
if [ $? -eq 0 ]; then
echo "[Success]"
echo "================================================================================================================"
else
echo "[Failed]"
echo "================================================================================================================"
fi
getPID
if [ $PID -ne 0 ]; then
shutdown
fi
else
echo "$APP_MAIN is not running"
echo "================================================================================================================"
fi
}
shutdown
exit 0