```commands=$1
redeploy=$2
port="8088"
fileName="ai_plat-0.0.1.jar"
down_path="/home/finance/bak/"
tagert_path="/home/finance/"
now_date=`date "+%Y%m%d%H%M"`
new_fileName=$fileName$now_date
star_command="./autoDeploy.sh start $fileName"
restar_command="./autoDeploy.sh restart $fileName $port"
stop_command="./autoDeploy.sh stop $fileName $port"
if [ -n $redeploy]; then
echo "拉取最新jar"
cd $down_path
echo "进入目录 $down_path"
echo "开始下载....."
wget --ftp-user=download --ftp-password=donly2015 ftp://ftp.msxf.local/tmpai/dev/$fileName
echo "下载完成....."
cd $tagert_path
echo "备份线上jar"
cp $fileName $new_fileName
echo "删除线上jar"
#停止线上服务
eval $stop_command
rm $fileName
echo "移动最新jar到运行目录"
cd $down_path
mv $fileName $tagert_path
fi
if [ $commands == "start"x ]; then
eval $star_command
elif [ $commands == "restart"x ]; then
eval $restar_command
elif [ $commands == "stop"x ]; then
eval $stop_command
else
echo "输入不合法"
echo "正确格式:./deploy.sh 命令【start、restart、stop】 是否拉新包"
fi
简单本机部署java服务脚本
最新推荐文章于 2022-08-01 09:26:08 发布