forked from TraceNature/redissyncer-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredissyncer.sh
executable file
·99 lines (77 loc) · 1.5 KB
/
redissyncer.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
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
#!/bin/bash
# config java
export JAVA_HOME=$HOME/openlogic-openjdk-8u262-b10-linux-64
export PATH=$JAVA_HOME/bin:$PATH:.
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
SHELL_FOLDER=$(dirname $(readlink -f "$0"))
jarpath=${SHELL_FOLDER}/syncer-webapp
jarname=redissyncer-server.jar
jarproc=`jps | grep ${jarname} `
procnum=`echo ${jarproc}|awk '{print $1}'`
help()
{
cat << EOF
Usage: $0 start|stop|status|restart
EOF
exit 0
}
start()
{
echo "starting ${jarname}"
if [ "" != "${procnum}" ] ;then
echo "${jarname} is running please stop it firest!"
echo "${jarname} start failure!"
exit 1
fi
java -Xms4096m -Xmx4096m -jar ${jarpath}/${jarname} \
-XX:-UseGCOverheadLimit \
--logging.level.root=info \
--server.port=8080 \
>> stdout.log &2>1 &
sleep 2
proc=`jps | grep ${jarname}|awk '{print $1}' `
if [ "" = "${proc}" ] ;then
echo "${jarname} start failure!"
else
echo "${jarname} start success!"
echo `jps -lvm|grep ${proc}`
fi
exit 0
}
status()
{
if [ "" = "${procnum}" ] ;then
echo "${jarname} not available!!"
else
echo "${jarname} is running!"
echo `jps -lvm|grep ${procnum}`
fi
}
stop()
{
if [ "" = "${procnum}" ] ;then
echo "${jarname} is already stopped!!"
exit 0
fi
kill -15 ${procnum}
echo ${jarproc} be killed !
echo ${jarname} stopped !
}
restart()
{
stop
start
}
if [ -z "$1" ]; then
help
exit 0
fi
case $1 in
[hH][eE][lL][pP]) help ;;
-[hH]) help ;;
start) start ;;
status) status ;;
stop) stop ;;
restart) restart ;;
*) help ;;
esac