forked from china-testing/python-api-tesing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup.sh
More file actions
executable file
·44 lines (39 loc) · 1.3 KB
/
startup.sh
File metadata and controls
executable file
·44 lines (39 loc) · 1.3 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
#!/bin/sh
# Author: xurongzhong#126.com wechat:pythontesting qq:37391319
# CreateDate: 2018-02-08 qq群: 144081101
# startup.sh
APP_MAIN=older.py
APP_LOG=logs
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
}
startup(){
getPID
echo "================================================================================================================"
if [ $PID -ne 0 ]; then
echo "$APP_MAIN already started(PID=$PID)"
echo "================================================================================================================"
else
echo -n "Starting $APP_MAIN"
if [ ! -d "../$APP_LOG" ]; then
mkdir "../$APP_LOG"
fi
nohup python3 $APP_MAIN > ../$APP_LOG/nohup.log 2>&1 &
sleep 2
getPID
if [ $PID -ne 0 ]; then
echo "(PID=$PID)...[Success]"
echo "================================================================================================================"
else
echo "[Failed]"
echo "================================================================================================================"
fi
fi
}
startup