chmod -R 755 bin

scp target/*.jar ubuntu@x:/home/ubuntu/checker/

scp config/*.yml ubuntu@x:/home/ubuntu/checker/

scp bin/* ubuntu@x:/home/ubuntu/checker/

ssh ubuntu@x "/home/ubuntu/checker/shutdown"

ssh ubuntu@x "/home/ubuntu/checker/launch" > /dev/null 2>&1 &

sleep 1

 

chmod -R 755 bin

scp bin/* ubuntu@192.168.8.x:/home/ubuntu/checker/

ssh ubuntu@x.x "/home/ubuntu/checker/shutdown"

ssh ubuntu@x.x "/home/ubuntu/checker/preboot"

scp target/*.jar ubuntu@x:/home/ubuntu/checker/

ssh ubuntu@x.x "/home/ubuntu/checker/launch test" > /dev/null 2>&1 &

sleep 1

launch

#!/bin/bash

cd /home/ubuntu/checker/

echo ">>> launch begin"

if [ -z "$1" ]; then

echo "profile is not assign. eg: launch test, launch production "

exit 1

fi

echo ">>> launch $1"

./startup "$1"

 

preboot

#!/bin/bash

echo ">>> pre boot begin"

if [ ! -d /home/ubuntu/checker/archive ];then

mkdir -p /home/ubuntu/checker/archive

else

echo "archive exist"

fi

mv /home/ubuntu/checker/*.jar /home/ubuntu/checker/archive/

echo ">>> pre boot end"

shutdown

#!/bin/bash

PID=`ps -ef | grep java | grep checker* | awk '{print $2}'`

echo ">>> shutdown begin "

if [ -z "$PID" ]; then

echo "checker not started"

else

kill ${PID} > /dev/null 2>&1

echo ">>> shutdown success, pid ${PID}"

fi

startup

#!/bin/bash

echo ">>> startup profile $1 begin"

nohup java -jar /home/ubuntu/checker/*.jar --spring.profiles.active=$1 /dev/null 2>&1 &

echo ">>> startup profile $1 end"

 

精彩内容

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。