修改权限改造引起的bug
This commit is contained in:
64
shell/jar-run2.sh
Normal file
64
shell/jar-run2.sh
Normal file
@ -0,0 +1,64 @@
|
||||
#cription: 启动重启server服务
|
||||
#端口号,根据此端口号确定PID
|
||||
PORT=767
|
||||
#启动命令所在目录
|
||||
HOME='/home/sszn/task-agc'
|
||||
|
||||
#查询出监听了test.jar端口TCP协议的程序
|
||||
pid=$(ps -ef | grep gdw-agc-task-1.0.0.0.jar | grep -v grep | awk '{print $2}')
|
||||
|
||||
start(){
|
||||
echo "start running cloud-core ............... "
|
||||
if [ -n "$pid" ]; then
|
||||
echo "server already start,pid:$pid"
|
||||
echo "pid:$pid agc-job port:$PORT 服务已经在运行了,请停止后再 执行 sh run.sh start "
|
||||
return 0
|
||||
fi
|
||||
#进入命令所在目录
|
||||
cd $HOME
|
||||
# 启动服务控制台日志输出到nohup.out文件中
|
||||
nohup java -jar gdw-agc-task-1.0.0.0.jar >> /home/sszn/task-agc/log/agc-$(date +%Y-%m-%d).log 2>&1 &
|
||||
echo "running success agc-job port:$PORT"
|
||||
echo "agc-job port:$PORT 服务启动成功 ..... "
|
||||
}
|
||||
|
||||
stop(){
|
||||
echo "stopping running cloud-core ............... "
|
||||
if [ -z "$pid" ]; then
|
||||
echo "not find program on port:$PORT"
|
||||
echo "agc-job port:$PORT 服务已经被关闭了请执行 sh run.sh start "
|
||||
return 0
|
||||
fi
|
||||
#结束程序,使用讯号2,如果不行可以尝试讯号9强制结束
|
||||
kill -9 $pid
|
||||
rm -rf $pid
|
||||
echo "kill program use signal 2,pid:$pid"
|
||||
}
|
||||
|
||||
status(){
|
||||
if [ -z "$pid" ]; then
|
||||
echo "not find program on port:$PORT"
|
||||
else
|
||||
echo "program is running,pid:$pid"
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 2
|
||||
$0 start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status}"
|
||||
exit 0
|
||||
esac
|
||||
1
shell/log.sh
Normal file
1
shell/log.sh
Normal file
@ -0,0 +1 @@
|
||||
tail -f nohup.out
|
||||
1
shell/start.sh
Normal file
1
shell/start.sh
Normal file
@ -0,0 +1 @@
|
||||
nohup java -jar yshop-api-2.0.jar --spring.profiles.active=prod &
|
||||
7
shell/stop.sh
Normal file
7
shell/stop.sh
Normal file
@ -0,0 +1,7 @@
|
||||
PID=$(ps -ef | grep yshop-api-2.0.jar | grep -v grep | awk '{ print $2 }')
|
||||
if [ -z "$PID" ];then
|
||||
echo Application is already stopped
|
||||
else
|
||||
echo kill $PID
|
||||
kill $PID
|
||||
fi
|
||||
81
shell/yshop.sh
Normal file
81
shell/yshop.sh
Normal file
@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
INPUT=$2
|
||||
FILE_PATH=`readlink -f ${INPUT}`
|
||||
SERVICE=${INPUT##*/}
|
||||
SERVICE_NAME=${SERVICE%.*}
|
||||
DEPLOY_DIR=`pwd`
|
||||
JVM_OPTS="-server -Xms64m -Xmx128m"
|
||||
|
||||
if [[ "$1" = "" ]];
|
||||
then
|
||||
echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$SERVICE" = "" ]];
|
||||
then
|
||||
echo -e "\033[0;31m 未输入应用名 \033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOGS_DIR="$DEPLOY_DIR/logs/$SERVICE_NAME"
|
||||
echo "$LOGS_DIR"
|
||||
if [[ ! -d "$LOGS_DIR" ]]; then
|
||||
mkdir -p ${LOGS_DIR}
|
||||
fi
|
||||
|
||||
LOG_PATH="$LOGS_DIR/stdout.out"
|
||||
pid=0
|
||||
|
||||
start()
|
||||
{
|
||||
checkPid
|
||||
if [[ ! -n "$pid" ]]; then
|
||||
BUILD_ID=dontKillMe nohup java ${JVM_OPTS} -jar ${FILE_PATH} >> ${LOG_PATH} 2>&1 &
|
||||
echo "$SERVICE_NAME is starting you can check the $LOG_PATH"
|
||||
else
|
||||
echo "$SERVICE_NAME is runing PID: $pid"
|
||||
fi
|
||||
}
|
||||
|
||||
checkPid()
|
||||
{
|
||||
pid=`ps -ef |grep ${FILE_PATH} |grep -v grep |awk '{print $2}'`
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
checkPid
|
||||
if [[ ! -n "$pid" ]]; then
|
||||
echo "$SERVICE_NAME not runing"
|
||||
else
|
||||
echo "$SERVICE_NAME stop..."
|
||||
kill -9 ${pid}
|
||||
fi
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
stop
|
||||
sleep 2
|
||||
start
|
||||
}
|
||||
|
||||
status()
|
||||
{
|
||||
checkPid
|
||||
if [[ ! -n "$pid" ]]; then
|
||||
echo "$SERVICE_NAME not runing"
|
||||
else
|
||||
echo "$SERVICE_NAME runing PID: $pid"
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start) start;;
|
||||
stop) stop;;
|
||||
restart) restart;;
|
||||
status) status;;
|
||||
*) echo "require start|stop|restart|status" ;;
|
||||
esac
|
||||
Reference in New Issue
Block a user