start.sh
#!bin/sh
CRTDIR=/opt/lincya
nohup java -jar /opt/lincya/sp.war --spring.config.location=${CRTDIR}/application.properties --logging.config=${CRTDIR}/logback-spring.xml > /dev/null 2>&1 &
while( [ ! -e ${CRTDIR}/logs/api.log ] )
do
echo 'Wait for the api.log file to be generated...'
/usr/bin/sleep 2
done
tail -f ${CRTDIR}/logs/api.log
stop.sh
#!bin/sh
CRTDIR=/opt/lincya
count=`ps -ef | grep sp.war | grep -v "grep" | wc -l`
if [ $count -gt 0 ]; then
echo "准备停止sp服务...."
ps -ef | grep sp.war | grep -v "grep" | awk '{printf $2}' | xargs kill -9
sleep 2
DATE=`date +%Y-%m-%d-%H-%M` #获取当前系统时间
if [ -e ${CRTDIR}/logs/api.log ]; then
mv ${CRTDIR}/logs/api.log ${CRTDIR}/logs/api_${DATE}.log
fi
echo "sp服务已停止"
else
echo "服务已处理停止状态,无需停止!"
fi