48 lines
860 B
Bash
48 lines
860 B
Bash
#! /bin/bash
|
|
#chkconfig: 2345 85 15
|
|
#description:auto_run
|
|
#processname:ucs
|
|
#JAR根位置
|
|
PROFILES_ACTIVE=$2
|
|
JAR_ROOT=$(pwd)
|
|
#JAR位置
|
|
JAR_PATH="$JAR_ROOT"/renren-admin.jar
|
|
|
|
#LOG位置
|
|
LOG_PATH=/dev/null
|
|
|
|
# 参数校验
|
|
if [ -z "$PROFILES_ACTIVE" ]; then
|
|
PROFILES_ACTIVE = "prod"
|
|
fi
|
|
|
|
#开始方法
|
|
start() {
|
|
cd $JAR_ROOT
|
|
nohup java -Dfile.encoding=utf-8 -server -Xms256m -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -Duser.timezone=GMT+08 -XX:HeapDumpPath=./ -jar --spring.profiles.active=$PROFILES_ACTIVE $JAR_PATH >$LOG_PATH 2>&1 &
|
|
echo "$JAR_PATH start success."
|
|
}
|
|
|
|
#结束方法
|
|
stop() {
|
|
kill -9 $(ps -ef | grep $JAR_PATH | grep -v grep | grep -v stop | awk '{print $2}')
|
|
echo "$JAR_PATH stop success."
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart)
|
|
stop
|
|
start
|
|
;;
|
|
*)
|
|
echo "Userage: $0 {start|stop|restart}"
|
|
exit 1
|
|
;;
|
|
esac
|