Skip to content

Instantly share code, notes, and snippets.

@frdmn
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frdmn/aa4d8458f8477f45551e to your computer and use it in GitHub Desktop.
Save frdmn/aa4d8458f8477f45551e to your computer and use it in GitHub Desktop.
This script checks every 5 minutes if your working git repo has any changed content and if so, it'll "wall" a message to all connected Terminal shells.
#!/usr/bin/env bash
repodir="/opt/minecraft/mc-yeahwhat/plugins"
wallmsgprefix="[git] [plugin-configs]"
wallmsg="${wallmsgprefix} Caution: there are changes in \"${repodir}\" that are not tracked. Make sure to add and commit them!"
tempfile=$(mktemp /tmp/git-dirty_XXXXXXX)
####
echo ${wallmsg} > ${tempfile}
cd ${repodir}
if [[ `git status --porcelain` ]]; then
wall -n ${tempfile}
fi
rm ${tempfile}
#
# cronjobs file for dirty-git-check
#
*/5 * * * * root /usr/local/bin/dirty-git-check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment