Skip to content

Instantly share code, notes, and snippets.

@netodevel
Created February 8, 2017 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netodevel/0273e267b2808c51b3a9370a960ebb2f to your computer and use it in GitHub Desktop.
Save netodevel/0273e267b2808c51b3a9370a960ebb2f to your computer and use it in GitHub Desktop.
echo "setup deploy"
function setup() {
mkdir -p deploy
cd deploy
mkdir -p develop
mkdir -p production
}
if [ -d /home/{YOUR_USER}/deploy ]; then
echo "YES";
else
echo "NO";
setup
fi
echo "update master branch"
cd /home/{YOUR_USER}/deploy/production
git pull https://{YOUR_USER_GIT}:{YOUR_PASSWORD_GIT}@{URL_GIT}
echo "build project"
if mvn clean package; then
echo build ok
else
echo Something went wrong.
exit 1
fi
echo "moving file"
mv -f target/{JAR_NAME}.jar /home/{YOUR_USER}/deploy/production
echo "kill process"
kill `ps -ef | grep "java -jar -Dspring.profiles.active=production /home/{YOUR_USER}/deploy/production/{JAR_NAME}"| grep -v grep | awk '{ print $2 }'`
echo "run application production"
nohup java -jar -Dspring.profiles.active=production /home/{YOUR_USER}/deploy/production/{JAR_NAME}.jar > /home/{YOUR_USER}/deploy/production/server-prod.log 2>&1 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment