The company project used Springboot. Applications that are developed need to be automatically uploaded to the server. Although the current thermal deployment is not fully mastered. First use the shell to simplify deployment.
# upload Key Sshloginkey=/f/myfile/root.key# items in the local directory MyProject=/d/myproject/comment# The path on the remote host RemoteHost=[Email Protected]remotepath= $RemoteHost:/data/if[-F"$sshLoginKey"-a-d"$MyProject"]; ThenCD $MyProject # output error only MVN clean package-Q # Find files packaged in the target directory in the last 1 minutes, decoupled from filenames, more generic filename=$(FindTarget-size +15m-type F-cmin-1) if[-E"$fileName"]; Then Echo "Package Success" SCP-P2233-i $sshLoginKey $fileName $RemotePath; if[$?-eq0]; Then Echo "upload succeeded. "; # Stop ServiceSSH-P2233$RemoteHost-I. $sshLoginKey"ps-ef | awk ' \ $NF ~/comment/{print \$2} ' | Xargs kill-9"# Start Service #SSH-P2233$RemoteHost-I. $sshLoginKey"/root/jdk1.8.0_152/bin/java-jar/data/comment.jar 2>&1 >/var/log/comments.log &" Else Echo "upload failed. "; fi Else Echo "Package failed"Exit1 fi if[-F"$fileName"]; Then RM-RF $fileNamefiElse Echo "key or item does not exist"; Sleep5s;fi
Shell scripts automatically deploy Springboot apps