<servers> <!-- server | Specifies the authentication information to use when connecting to a particular server, identified by | a unique name within the system (referred to by the 'id' attribute below). | | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are | used together. | <server> <id>deploymentRepo</id> <username>repouser</username> <password>repopwd</password> </server> -->
<!-- Another sample, using keys to authenticate. <server> <id>siteServer</id> <privateKey>/path/to/private/key</privateKey> <passphrase>optional; leave empty if not used.</passphrase> </server> --> <server> <id>ming-ubuntu</id> <username>ubuntu</username> <password>xxxxxxxxxx</password> </server> </servers>
部署shell
在root目录编写执行脚本 deploy.sh 内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/bash #author lcz # date 2019-09-26 # upload package name NAMEDEPLOY='workbench.jar' # stop the process before ID=`ps -ef | grep "$NAMEDEPLOY" | grep -v "grep" | awk '{print $2}'` echo The process pid is $ID for id in $ID do kill -9 $id echo killed $id done cd /home/ubuntu/workbench/ && nohup /home/ubuntu/.sdkman/candidates/java/17.0.1-open/bin/java -jar $NAMEDEPLOY --spring.profiles.active=prod > workbench.out 2>&1 & exit 0