Created
February 20, 2019 01:23
-
-
Save lachlanagnew/f45ea46179df09799003b605bad1b713 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOME=/home/ubuntu | |
APP=$HOME/App | |
PIDF=$APP/app.pid | |
CMD=$APP/app.sh | |
LOG=$HOME/deploy.log | |
/bin/echo "$(date '+%Y-%m-%d %X'): Initializing Deployment for $APPLICATION_NAME - $DEPLOYMENT_ID " >> $LOG | |
cd $APP | |
if [ -f $CMD ] | |
then | |
$CMD stop | |
/bin/echo "$(date '+%Y-%m-%d %X'): Stopping $APPLICATION_NAME" >> $LOG | |
elif [ -f $PIDF ] | |
then | |
PID=`cat $PIDF` | |
kill -9 $PID | |
/bin/echo "$(date '+%Y-%m-%d %X'): Killing $APPLICATION_NAME [$PID]" >> $LOG | |
rm $PIDF | |
else | |
/bin/echo "$(date '+%Y-%m-%d %X'): $CMD not found. Proceeding with deployment" >> $LOG | |
fi | |
/bin/echo "$(date '+%Y-%m-%d %X'): ** Application Stop Hook Completed **" >> $LOG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment