jenkins简单部署后,使用shell脚本启动并备份springboot的jar包
#!/bin/bash
#cd /home/hydev/devops
source /etc/profile
base_dir=$(pwd)
app_version=1.0.0-SNAPSHOT
app_name_tip=ehr-server-$app_version
echo ">>>> ---delete oldfile --- <<<<"
rm -rf $app_name_tip.jar;
sleep 3s;
echo ">>>> --- mv file temp to dir --- <<<<"
find $base_dir/ssh/ -name *.jar -exec mv {} $base_dir/ \;
#获取当前时间
sleep 2s;
time=$(date +"%Y%m%d%H%M%S")
cp $app_name_tip.jar $base_dir/bak/ehr-server$time.jar
sleep 2s;
rm -rf $base_dir/ssh/*
echo
sh boot.sh restart $app_name_tip