Skip to content

Instantly share code, notes, and snippets.

@johndstein
Created January 8, 2018 15:16
Show Gist options
  • Save johndstein/c81a0eb60b48a4f4a9cf199c88b6e7ab to your computer and use it in GitHub Desktop.
Save johndstein/c81a0eb60b48a4f4a9cf199c88b6e7ab to your computer and use it in GitHub Desktop.
Check if Git up to date
#!/usr/bin/env bash
set -e
#
# Check and see if I have been updated.
# If not, do nothing. If yes, run my deployment script.
#
# We can run this every minute.
# crontab -e
# * * * * * /home/ubuntu/glo.sh/bin/pullme.sh >/dev/null 2>&1
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $MY_DIR
cd ..
OUTPUT="$(git pull)"
if [[ "$OUTPUT" != *"Already up-to-date"* ]]; then
$MY_DIR/deploy.sh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment