jar包的启动和停止脚本

启动:

    

#!/bin/sh

 

 

PIDFILE="/app/eureka/eureka.pid"

LOGFILE="/app/eureka/out.log"

 

 

if [ -f "$PIDFILE" ] && kill -0 $(cat "$PIDFILE"); then

echo "eureka is already running..."

exit 1

fi

nohup java -Xms128m -Xmx1024m  -jar zxf-eureka-0.0.1-SNAPSHOT.jar > $LOGFILE & echo $! > $PIDFILE

echo "eureka start..."

 

停止:

  

#!/bin/sh

 

 

PIDFILE="/app/eureka/eureka.pid"

if [ ! -f "$PIDFILE" ] || ! kill -0 "$(cat "$PIDFILE")"; then

echo "eureka not running..."

else

echo "stopping eureka..."

PID="$(cat "$PIDFILE")"

kill -9 $PID

rm "$PIDFILE"

echo "....eureka stopped"

fi

 

posted @ 2018-06-14 22:34  随风而逝,只是飘零  阅读(2549)  评论(0编辑  收藏  举报