Skip to content

Instantly share code, notes, and snippets.

@gdouzwt
Created March 4, 2022 13:09
Show Gist options
  • Save gdouzwt/a97a2a803e76cb6f651dd0b6d2a8ce4a to your computer and use it in GitHub Desktop.
Save gdouzwt/a97a2a803e76cb6f651dd0b6d2a8ce4a to your computer and use it in GitHub Desktop.
others
nohup .sdks/webhook-linux-amd64/webhook -hooks hooks.json -verbose &
#!/usr/bin/env bash
set -e
if [ ! $1 ]; then
echo "参数为空,请输入版本号! 用法: deploy 版本号"
else
cd /home/developer/toDeploy
FILE=/home/developer/.m2/repository/cc/seedland/uc/uc-users-rest/$1/uc-users-rest-$1.jar
# 如果文件已经存在
if [ -f "$FILE" ]; then
echo "=============== 回滚到版本:$1 ======================================"
#cp -f /data/cockpit/releases/cockpit-$1.jar /data/cockpit/cockpit.jar
# 文件不存在则是新版本构建
else
echo "部署新版本 $1 的 jar"
echo "从 maven 仓库拉取出版本 $1 的 jar"
mvn dependency:copy -Dcockpit.version=$1
fi
echo "=============== 替换 jar ============================================="
cp -f /home/developer/toDeploy/cockpit.jar /data/cockpit/cockpit.jar
echo "============================================================"
chown developer:developer /data/cockpit/cockpit.jar
chmod 500 /data/cockpit/cockpit.jar
echo "=============== 启动服务 ============================================="
systemctl restart cockpit.service
systemctl status cockpit.service
fi
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.zwt</groupId>
<artifactId>deploy</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>deploy</name>
<properties>
<out.dir>./</out.dir>
</properties>
<repositories>
<repository>
<id>jizhit-jiashicang-jars</id>
<name>jiashicang Repository</name>
<url>https://jizhit-maven.pkg.coding.net/repository/jiashicang/jars/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jizhit-jiashicang-jars</id>
<name>jiashicang Repository</name>
<url>https://jizhit-maven.pkg.coding.net/repository/jiashicang/jars/</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<artifactItems>
<artifactItem>
<groupId>cc.seedland.uc</groupId>
<artifactId>uc-users-rest</artifactId>
<version>${cockpit.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${out.dir}</outputDirectory>
<destFileName>cockpit.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment