Created
May 25, 2018 16:23
-
-
Save likejazz/07a779ebc49f54b36ac8a940fdd90276 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
# This is a simple bash script that will poll github for changes to your repo, | |
# if found pull them down, and then rebuild and restart a API server. | |
while true | |
do | |
# move into your git repo where your API server src is | |
cd /home/deploy/workspace/go/src/github.daumkakao.com/iris/api | |
git fetch; | |
LOCAL=$(git rev-parse HEAD); | |
REMOTE=$(git rev-parse @{u}); | |
# if our local revision id doesn't match the remote, we will need to pull the changes | |
if [ $LOCAL != $REMOTE ]; then | |
git pull origin master | |
make | |
killall api-v0.6 | |
# How to make output of any shell command unbuffered? | |
# http://stackoverflow.com/a/25548995/3513266 | |
stdbuf -i0 -o0 -e0 nohup ./api-v0.6 >api.log 2>api.err & | |
fi | |
echo -n "." | |
sleep 10 # every 10 seconds | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment