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