-
Notifications
You must be signed in to change notification settings - Fork 32
/
make.sh
executable file
·75 lines (68 loc) · 1.92 KB
/
make.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
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -e
CUR_DIR=$PWD
SRC_DIR=$PWD
BIN_DIR=$PWD/bin
CONF_DIR=$PWD/config
SERVICE_DIR=$PWD/services/
FLAGS=-race
case $1 in
"start")
mkdir -p $CONF_DIR
ln -sf $SRC_DIR/common/config/framework.toml $CONF_DIR/
ln -sf $SRC_DIR/default_plugins/login/login.toml $CONF_DIR/
cd $BIN_DIR
mkdir -p $BIN_DIR/logs
mkdir -p $BIN_DIR/logs.back
if [[ `ls -l ./logs | wc -l` > 1 ]]; then
mv -f ./logs/* ./logs.back/
fi
plugins=`ls | grep .so | awk -F"." '{print $1}'`
for plugin_name in $plugins; do
c=1
if [[ $plugin_name != "mgr" && $plugin_name != "match" ]]; then
c=3
fi
for (( i=1; i<=$c; i++ )); do
nohup ./go-xserver --app $plugin_name --suffix $i > /dev/null 2>&1 &
done
done
sleep 1s
ps -ux | grep go-xserver
exit 0
;;
"stop")
pkill go-xserver
sleep 5s
ps -ux | grep go-xserver
exit 0
;;
"")
export GOPROXY=https://goproxy.io
cd $SRC_DIR
go generate ./...
cd $SRC_DIR
go vet ./...
echo "start build ..."
cd $SRC_DIR/default_plugins
plugins=`ls -l | grep '^d' | awk '{print $9}' | grep -v 'internal\|bin'`
for plugin_name in $plugins; do
go build $FLAGS -buildmode=plugin -o $BIN_DIR/$plugin_name.so ./$plugin_name;
done
cd $SERVICE_DIR
plugins=`ls -l | grep '^d' | awk '{print $9}' | grep -v 'internal'`
for plugin_name in $plugins; do
go build $FLAGS -buildmode=plugin -o $BIN_DIR/$plugin_name.so ./$plugin_name;
done
cd $SRC_DIR
go build $FLAGS -o $BIN_DIR/go-xserver .
echo "done"
exit 0
;;
esac
echo "Usage:"
echo " make.sh"
echo " make.sh start"
echo " make.sh stop"
cd $CUR_DIR
exit 0