forked from ixre/go2o
-
Notifications
You must be signed in to change notification settings - Fork 0
/
go2o.sh
executable file
·62 lines (56 loc) · 1.76 KB
/
go2o.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
### ### ### ###
# # ## # # ##
# # # # # #
# # # # ## # #
# # # # # # #
### ### ### ###
prod="go2o"
conf="conf"
debug=0
log_dir="./logs"
cmd=""
while getopts "s:c:dev" args
do
case ${args} in
v) ./go2o-serve -v && exit 1;;
e) echo "extra update files ..." && \
tar xvzf ${prod}-update.tar.gz;;
d) debug=1;;
s) cmd=${OPTARG};;
c) conf=${OPTARG};;
\?) echo "usage args [-s][-v] [-e] [-c] [-d]"
echo " -s : exec command,[stop|start|clean|restart]"
echo " -e : extra update zip file"
echo " -c : config file"
echo " -v : print version"
exit 1;;
esac
done
# clean cache
if [[ ${cmd} = "clean" ]];then
./master-serve -conf=app.conf -clean
fi
# stop service
if [[ ${cmd} = "stop" ]] || [[ ${cmd} = "restart" ]];then
proc_arr=("go2o-serve" "master-serve" "go2o-tcp" "go2o-rpc")
for proc in ${proc_arr[@]}
do
ps -ef| grep ${proc}| awk '{print $2}'| xargs kill -15
done
fi
# start service
if [[ ${cmd} = "start" ]] || [[ ${cmd} = "restart" ]];then
mkdir -p ${log_dir}
chmod a+x go2o-serve master-serve go2o-tcpserve go2o.sh
if [[ ${debug} = 1 ]];then
nohup ./go2o-serve -debug -conf=app.conf -d -r>${log_dir}/go2o.log 2>&1 &
nohup ./master-serve -debug -conf=app.conf>${log_dir}/master.log 2>&1 &
nohup ./go2o-tcpserve -debug -conf=app.conf>${log_dir}/tcp.log 2>&1 &
else
nohup ./go2o-serve -conf=app.conf -d -r>${log_dir}/go2o.log 2>&1 &
nohup ./master-serve -conf=app.conf>${log_dir}/master.log 2>&1 &
nohup ./go2o-tcpserve -conf=app.conf>${log_dir}/tcp.log 2>&1 &
fi
sleep 2 && echo "boot success" && exit 1
fi