-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathrun.sh
More file actions
94 lines (84 loc) · 2.27 KB
/
run.sh
File metadata and controls
94 lines (84 loc) · 2.27 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
IFS=$'\n\n'
#field=$1
#action=$2
source ../function.sh
function choose_action(){
option=$(whiptail --title "命令选择" --clear --menu "请选择其中一个:" 12 35 3 \
"test" "聊天测试" "find" "查找进程" "kill" "关闭进程" "restart" "重启进程" \
3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
echo $option
else
echo ''
fi
}
function kill_process(){
echo 'kill process'
ids=$(get_pid 'mq_cnnclassify' ' '${field}' ')
echo "kill mq_cnnclassify ${field}"
if [[ ${ids} != '' ]]; then
for id in ${ids}
do
echo 'kill '${id}
kill ${id}
done
fi
}
field=$(choose_field)
if [[ ${field} = 'bank_psbc' ]];then
field='psbc'
fi
if [[ ${field} != '' ]]; then
action=$(choose_action)
fi
if [[ ${action} != '' ]]; then
if [[ ${action} = 'restart' || ${action} = 'start' ]]; then
num=$(input_num)
if [[ ${num} != '' ]]; then
confirm=$(choose_confirm '场景:'$field ' 命令:'$action'\n数量:'$num)
fi
else
confirm=$(choose_confirm '场景:'$field' 命令:'$action' ')
fi
# confirm=$(choose_confirm '场景:'$field' 命令:'$action' ')
fi
if [[ ${confirm} != '' ]]; then
case $action in
'test')
echo ${field}
python3.5 classify.py ${field}
;;
'find')
result=$(get_pid 'mq_cnnclassify' ' '${field}' ')
echo 'mq_classify: '${result}
;;
'kill')
result=$(kill_process)
for line in ${result}
do
echo $line
done
;;
'restart')
result=$(kill_process)
for line in ${result}
do
echo $line
done
echo 'start process'
if [ ${field} = 'psbc' ];then
path="../work_space/categories/module/cnn_multi"
else
path="../work_space/${field}/module/cnn_multi"
fi
echo ${path}
for i in `seq $num`
do
nohup python3.5 mq_cnnclassify.py ${field} ${path} >/dev/null 2>nohup.out &
done
echo 'done!'
;;
esac
fi