Skip to content

Instantly share code, notes, and snippets.

@mooyoul
Created July 10, 2017 10:22
Show Gist options
  • Save mooyoul/47da975d75989e20ff04de443101920b to your computer and use it in GitHub Desktop.
Save mooyoul/47da975d75989e20ff04de443101920b to your computer and use it in GitHub Desktop.
Check last git commit id has changed
#!/bin/bash
echo 'Checking last commit id'
# Change repo to monitor
GIT_REPO=https://github.com/torvalds/linux.git
LATEST_COMMIT_LOG=$(git ls-remote $GIT_REPO refs/heads/master)
LAST_FETCHED_COMMIT_LOG=$(cat /tmp/last-commit.log 2>/dev/null)
if [ "$LATEST_COMMIT_LOG" != "$LAST_FETCHED_COMMIT_LOG" ]
then
echo 'different!'
# do stuff
fi
@breath103
Copy link

yum install inotify-tools

while true; do
inotifywait -e close_write /etc/nginx/nginx.conf | sudo service nginx restart;
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment