mirror of https://gitee.com/y_project/RuoYi.git
parent
c7300ddd03
commit
886b05c085
@ -1,86 +1,86 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
AppName=RuoYi.jar
|
AppName=RuoYi.jar
|
||||||
|
|
||||||
#JVM参数
|
#JVM参数
|
||||||
JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
|
JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
|
||||||
APP_HOME=`pwd`
|
APP_HOME=`pwd`
|
||||||
LOG_PATH=$APP_HOME/logs/$AppName.log
|
LOG_PATH=$APP_HOME/logs/$AppName.log
|
||||||
|
|
||||||
if [ "$1" = "" ];
|
if [ "$1" = "" ];
|
||||||
then
|
then
|
||||||
echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m"
|
echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$AppName" = "" ];
|
if [ "$AppName" = "" ];
|
||||||
then
|
then
|
||||||
echo -e "\033[0;31m 未输入应用名 \033[0m"
|
echo -e "\033[0;31m 未输入应用名 \033[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function start()
|
function start()
|
||||||
{
|
{
|
||||||
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
||||||
|
|
||||||
if [ x"$PID" != x"" ]; then
|
if [ x"$PID" != x"" ]; then
|
||||||
echo "$AppName is running..."
|
echo "$AppName is running..."
|
||||||
else
|
else
|
||||||
nohup java -jar $JVM_OPTS target/$AppName > /dev/null 2>&1 &
|
nohup java -jar $JVM_OPTS target/$AppName > /dev/null 2>&1 &
|
||||||
echo "Start $AppName success..."
|
echo "Start $AppName success..."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop()
|
function stop()
|
||||||
{
|
{
|
||||||
echo "Stop $AppName"
|
echo "Stop $AppName"
|
||||||
|
|
||||||
PID=""
|
PID=""
|
||||||
query(){
|
query(){
|
||||||
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
||||||
}
|
}
|
||||||
|
|
||||||
query
|
query
|
||||||
if [ x"$PID" != x"" ]; then
|
if [ x"$PID" != x"" ]; then
|
||||||
kill -TERM $PID
|
kill -TERM $PID
|
||||||
echo "$AppName (pid:$PID) exiting..."
|
echo "$AppName (pid:$PID) exiting..."
|
||||||
while [ x"$PID" != x"" ]
|
while [ x"$PID" != x"" ]
|
||||||
do
|
do
|
||||||
sleep 1
|
sleep 1
|
||||||
query
|
query
|
||||||
done
|
done
|
||||||
echo "$AppName exited."
|
echo "$AppName exited."
|
||||||
else
|
else
|
||||||
echo "$AppName already stopped."
|
echo "$AppName already stopped."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restart()
|
function restart()
|
||||||
{
|
{
|
||||||
stop
|
stop
|
||||||
sleep 2
|
sleep 2
|
||||||
start
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
function status()
|
function status()
|
||||||
{
|
{
|
||||||
PID=`ps -ef |grep java|grep $AppName|grep -v grep|wc -l`
|
PID=`ps -ef |grep java|grep $AppName|grep -v grep|wc -l`
|
||||||
if [ $PID != 0 ];then
|
if [ $PID != 0 ];then
|
||||||
echo "$AppName is running..."
|
echo "$AppName is running..."
|
||||||
else
|
else
|
||||||
echo "$AppName is not running..."
|
echo "$AppName is not running..."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
start)
|
start)
|
||||||
start;;
|
start;;
|
||||||
stop)
|
stop)
|
||||||
stop;;
|
stop;;
|
||||||
restart)
|
restart)
|
||||||
restart;;
|
restart;;
|
||||||
status)
|
status)
|
||||||
status;;
|
status;;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in new issue