-
Notifications
You must be signed in to change notification settings - Fork 4
/
itb.sh
47 lines (39 loc) · 769 Bytes
/
itb.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
appdir=`pwd`
start(){
checklogdir
#nohup python3 main.py $1 >/dev/null 2>itberror.log &
nohup python3 main.py $1 >> $appdir/var/log/itb.$1.log 2>&1 &
#python3 main.py $1 >> $appdir/var/log/itb.$1.log 2>&1
echo "$1 start..."
}
stop(){
ps aux|grep python|grep $1|awk '{print $2}'|xargs kill
echo "$1 stop..."
}
restart(){
stop $1
start $1
}
checklogdir(){
if [ ! -d "$appdir/var/log" ];then
mkdir -p $appdir/var/log
fi
}
if [ $# = 2 ]
then
case "$2" in
start)
start $1
;;
stop)
stop $1
;;
restart)
restart $1
;;
esac
else
echo "Usage:"
echo " sh itb.sh <app> start|stop|restart"
fi