Last active
August 29, 2015 14:14
-
-
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.
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
#!/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} |
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
# | |
# 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