Shell scripts automatically deploy Springboot apps

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.