#!/usr/bin/bash
# author : renguangyin@yingu.com
current=$(cd `dirname $0`; pwd)
cd ${current}
ext_name="jar"
exec_file=$(ls ${current}/data/*.${ext_name} -lt | grep -v total | awk {'print $9'} | head -n 1)
if [[ "${exec_file}" == "" ]]; then
echo "file not found!"
echo ${current}/data/
exit 1
fi
echo "kill service if it is running!"
pids=$(ps -ef | grep ${current}/ | grep .${ext_name} | grep -v grep | awk {'print $2'})
if [ "$pids" = "" ]; then
echo "no kill !"
else
echo "kill with $pids"
kill -9 ${pids}
fi
echo ${exec_file}
nohup /web/jdk1.8.0_102/bin/java
-Xms1024m -Xmx1024m
-jar ${exec_file} --spring.config.location=/testwork/data/config/application.yml --logging.config=/testwork/data/config/logback.xml > /testwork/logs/nohup.out 2>&1 &
sleep 1