-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshaco-foot
executable file
·100 lines (96 loc) · 1.54 KB
/
shaco-foot
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
95
96
97
98
99
100
#!/bin/bash
SERVERS="rpacc rpuser rprank world gateload game gate login"
ls() {
ps -ef |grep shaco |grep config
ps -ef |grep commandd |grep lua
}
startone() {
if [ $MEMCHECK -eq 0 ]
then
echo "start ${1}"
./shaco config_${1}.lua --sc_daemon 1
else
echo "start-memcheck ${1}"
valgrind -v \
--leak-check=full \
--show-reachable=yes \
--suppressions=shaco.supp \
--log-file=$HOME/log/${1}.vallog \
./shaco config_${1}.lua --sc_daemon 1
fi
sleep ${2}
}
startcmdd() {
cd tool && 2>&1 lua commandd.lua 0.0.0.0 7999 -d > ~/log/commandd.log
ps -ef |grep commandd |grep lua
}
startall() {
startone center 2
for S in $SERVERS;do
startone $S 0.5
done
sleep 1
ls
}
start() {
for S in $@;do
startone $S 0.5
done
ls
}
stop() {
if [ $MEMCHECK -eq 0 ]
then pkill -2 shaco
else pkill mem
fi
}
stopcmdd() {
pkill lua
}
restartall() {
stop
sleep 2
startall
}
USAGE="Usage: shaco-foot [startall] [start [svr .. ]] [stop] [ls] [startcmdd] [stopcmdd] -m"
MEMCHECK=0
CMD=$1
shift
while getopts ":m" optname
do
case "$optname" in
"m")
MEMCHECK=1
echo [memcheck mode]
;;
*)
#echo shout not be here
;;
esac
done
case "$CMD" in
restartall)
restartall
;;
startall)
startall
;;
start)
start "$@"
;;
stop)
stop
;;
startcmdd)
startcmdd
;;
stopcmdd)
stopcmdd
;;
ls)
ls
;;
*)
echo $USAGE
;;
esac