update deploy
This commit is contained in:
parent
53d8a98bbf
commit
c2db71d041
13
deploy.sh
13
deploy.sh
@ -20,15 +20,19 @@ deploy_server() {
|
|||||||
local app="$2"
|
local app="$2"
|
||||||
local jar="$3"
|
local jar="$3"
|
||||||
local port="$4"
|
local port="$4"
|
||||||
|
local srv_dir="$5"
|
||||||
if [ -z "$port" ]; then
|
if [ -z "$port" ]; then
|
||||||
port='22'
|
port='22'
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$srv_dir" ]; then
|
||||||
|
srv_dir="$app"
|
||||||
|
fi
|
||||||
|
|
||||||
local target_dir="/data/program/$app"
|
local target_dir="/data/program/$srv_dir"
|
||||||
local target_jar="$target_dir/lib/main.jar"
|
local target_jar="$target_dir/lib/main.jar"
|
||||||
scp -P $port $jar $server:"${target_jar}_new"
|
scp -P $port $jar $server:"${target_jar}_new"
|
||||||
ssh -p $port $server "$target_dir/bin/stop.sh;
|
ssh -p $port $server "$target_dir/bin/stop.sh;
|
||||||
mv $target_jar {$target_jar}_prev;
|
mv $target_jar ${target_jar}_prev;
|
||||||
mv ${target_jar}_new $target_jar && $target_dir/bin/start.sh"
|
mv ${target_jar}_new $target_jar && $target_dir/bin/start.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,9 +70,10 @@ if [ "$2" == "test" ]; then
|
|||||||
deploy_server 'xiadou@118.24.251.131' $APP $JAR
|
deploy_server 'xiadou@118.24.251.131' $APP $JAR
|
||||||
elif [ "$2" == "prod" ]; then
|
elif [ "$2" == "prod" ]; then
|
||||||
echo "Deploy prod."
|
echo "Deploy prod."
|
||||||
deploy_server 'xiandou@localhost' $APP $JAR '4025'
|
PORT=4026
|
||||||
|
deploy_server 'xiandou@localhost' $APP $JAR $PORT
|
||||||
if [ "$1" == "cms" ]; then
|
if [ "$1" == "cms" ]; then
|
||||||
ssh -p 4025 xiandou@localhost '/data/program/cms2/bin/stop.sh && /data/program/cms2/bin/start.sh'
|
ssh -p $PORT xiandou@localhost '/data/program/cms2/bin/stop.sh && /data/program/cms2/bin/start.sh'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user