Skip to content
This repository has been archived by the owner on Mar 8, 2018. It is now read-only.

Commit

Permalink
fix(continuous-updating): restart update immediately if changed in or…
Browse files Browse the repository at this point in the history
…igin
  • Loading branch information
coderbyheart committed Apr 1, 2014
1 parent 2c92964 commit 24110b3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions deployment/dothiv-web-01.dothiv.org.deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,37 @@ then
app/console --env=$ENV assetic:dump
fi

# Check if there is already a new update.
git fetch origin
# We specifically use the return code of the next command.
set +e
git diff --exit-code --quiet origin/master
if [ $? != 0 ]
then
echo "# New version exist on origin. Restarting ..."

# Protect against infinite loops
LOOPCOUNT=$[$1 +1]
if [ "$LOOPCOUNT" -lt "1" ]
then
echo "Invalid loopcount supplied."
exit 1
fi
if [ "$LOOPCOUNT" -gt "10" ]
then
echo "Infinite loop detected."
exit 1
fi

# Remove the lock only. Update will then pickup again.
rm -v $UPDATELOCK
# Launch again.
bash $0 $LOOPCOUNT
else
echo "# Nothing has changed in the meantime."
fi
set -e

echo ""
echo "# Deactivating maintenance page ..."
ln -sfv app.php web/index.php
Expand Down

0 comments on commit 24110b3

Please sign in to comment.