Created
July 10, 2017 10:22
-
-
Save mooyoul/47da975d75989e20ff04de443101920b to your computer and use it in GitHub Desktop.
Check last git commit id has changed
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 | |
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yum install inotify-tools
while true; do
inotifywait -e close_write /etc/nginx/nginx.conf | sudo service nginx restart;
done