forked from primihub/primihub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstop_server.sh
46 lines (41 loc) · 1.04 KB
/
stop_server.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
#!/bin/bash
user_pids=$(ps -ef | awk '{print $1}' |grep ${USER} |grep -v grep)
has_user_name=1
if [ -z "${user_pids}" ]; then
has_user_name=0
fi
function kill_app() {
app_name=$1
if [ -z "${app_name}" ]; then
echo "app is empty ${app_name}"
return -1
fi
if [ "${has_user_name}" == "0" ]; then
pids=$(ps -ef |grep "${app_name}" | grep -v grep |awk '{print $2}')
else
pids=$(ps -ef |grep "${app_name}" |grep ${USER} | grep -v grep |awk '{print $2}')
fi
echo $pids
if [ -n "${pids}" ]; then
kill -9 ${pids}
echo "stop ${app_name} done!"
fi
return 0
}
function main() {
#kill meta server
meta_app="fusion-simple.jar"
echo "begin to stop meta service"
kill_app ${meta_app}
echo "stop meta service done!"
#kill primihub server
primihub_app="task_main"
echo "begin to stop subprocess primihub service"
kill_app ${primihub_app}
echo "stop ${primihub_app} done!"
primihub_app="bazel-bin/node"
echo "begin to stop primihub service"
kill_app ${primihub_app}
echo "stop ${primihub_app} done!"
}
main