-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsms_simulator.sh
75 lines (67 loc) · 1.74 KB
/
sms_simulator.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
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check networking is up.
[ "$NETWORKING" = "no" ] && exit 0
RETVAL=0
PID=
#设置工作目录
WORK_DIR=.
#设置lib库目录
EXTEN_LIB_HOME=$WORK_DIR/lib
#设置执行类库目录
CLASS_DIR=$WORK_DIR/bin
#设置path路径分隔符
PATH_SPLIT=:
#设置java路径
JAVA=java
#设置classpath
CLASSPATH=$CLASSPATH$PATH_SPLIT$CLASS_DIR
for i in $EXTEN_LIB_HOME/*.jar; do
CLASSPATH="$CLASSPATH":"$i"
done
CLASSPATH="$CLASSPATH":"sms_simulator.jar"
export CLASSPATH
#设置pid文件
PIDFILE=$WORK_DIR/logs/sms_simulator.pid
#设置执行类
BEAN=net.qing.sms.simulator.SmsSimulatorStartupX
#JVM_OPTION="-server -Xms4G -Xmx4G -XX:NewSize=3584m -XX:PermSize=64m -XX:SurvivorRatio=1 -XX:+UseParallelGC -verbose:gc -XX:+PrintGCDetails -XX:-UseAdaptiveSizePolicy"
cd $WORK_DIR
case $1 in
start)
echo $$ > $PIDFILE;
exec $JAVA $JVM_OPTION -cp ${CLASSPATH} $BEAN;;
stop)
if [ -f $PIDFILE ] ;then
read PID < "$PIDFILE"
else
failure;echo;
echo -n $"$PIDFILE not found.";failure;echo
exit $RETVAL;
fi
if checkpid $PID; then
kill -TERM $PID >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ] ;then
success;echo
echo -n "Waiting for sms_simulator to shutdown .."
while checkpid $PID;do
echo -n "."
sleep 1;
done
success;echo;rm -f $PIDFILE
else
failure;echo
fi
else
echo -n $"sms_simulator is dead and $PIDFILE exists.";failure;echo
RETVAL=7
fi
;;
*)
echo "usage: $0 {start|stop}" ;;
esac
exit $RETVAL