build: shell script add

dev
gitea-관리자 1 year ago
parent 74c813ff8b
commit d06c44a4e4

@ -0,0 +1,17 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "-----------------------------------"
echo " Undefined parameter"
echo "./backupApi.sh [application name]"
echo "-----------------------------------"
exit 1
fi
if [ ! -f "$1.jar" ]; then
echo "==================================="
echo " $1.jar file not exist"
echo "==================================="
exit 1
fi
mv /applications/mens/$1.jar /applications/mens/$1.jar_backup
#cp /var/lib/jenkins/workspace/MENS-API/mens-api/target/mens-api.jar /applications/mens/ens-api.jar

@ -0,0 +1,18 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "-----------------------------------"
echo " Undefined parameter"
echo "./deployApi.sh [application name]"
echo "-----------------------------------"
exit 1
fi
if [ ! -f "$1.jar" ]; then
echo "==================================="
echo " $1.jar file not exist"
echo "==================================="
exit 1
fi
mv /applications/mens/$1.jar /applications/mens/$1.jar_backup
cp /var/lib/jenkins/workspace/MENS-API/mens-api/target/$1.jar /applications/mens/$1.jar

@ -1,3 +0,0 @@
#!/bin/sh
mv /applications/mens/mens-api.jar /applications/mens/mens-api.jar_backup
cp /var/lib/jenkins/workspace/MENS-API/mens-api/target/mens-api.jar /applications/mens/ens-api.jar

@ -0,0 +1,22 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "-----------------------------------"
echo " Undefined parameter"
echo "./startApi.sh [application name]"
echo "-----------------------------------"
exit 1
fi
if [ ! -f "$1.jar" ]; then
echo "==================================="
echo " $1.jar file not exist"
echo "==================================="
exit 1
fi
echo "================================"
echo " $1 deamon start"
echo "================================"
JAVA_HOME=/lib/jvm/java-17-openjdk
export JAVA_HOME
nohup $JAVA_HOME/bin/java -Dspring.profiles.active=prod -jar /applications/mens/$1.jar > /dev/null &

@ -1,7 +0,0 @@
#!/bin/sh
echo "======================"
echo "ens-api deamon start"
echo "======================"
JAVA_HOME=/lib/jvm/java-17-openjdk
export JAVA_HOME
nohup $JAVA_HOME/bin/java -Dspring.profiles.active=dev -jar /applications/mens/mens-api.jar > /dev/null &

@ -0,0 +1,20 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "-----------------------------------"
echo " Undefined parameter"
echo "./stopApi.sh [application name]"
echo "-----------------------------------"
exit 1
fi
PID=`ps -ef | grep java | grep $1- | awk '{print $2}'`
echo "Process ID: $PID"
if [ -z $PID ]; then
echo "No process is running"
else
echo "Kill process"
kill $PID
echo "========================="
echo "mens-api deamon stop"
echo "========================="
fi

@ -1,13 +0,0 @@
#!/bin/sh
PID=`ps -ef | grep java | grep ens-api- | awk '{print $2}'`
echo "Process ID: $PID"
if [ -z $PID ]; then
echo "No process is running"
else
echo "Kill process"
kill $PID
echo "========================="
echo "mens-api deamon stop"
echo "========================="
fi
Loading…
Cancel
Save