new checks
This commit is contained in:
27
check_git_status
Executable file
27
check_git_status
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# Copyright © 2010 by Daniel Friesel <derf@chaosdorf.de>
|
||||
# License: WTFPL:
|
||||
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
#
|
||||
# You probably need to run this check via sudo. For /etc,
|
||||
# > nagios ALL=(root) NOPASSWD: /usr/local/lib/nagios/plugins/check_git_status /etc
|
||||
# should do the job.
|
||||
|
||||
REPO="${1}"
|
||||
|
||||
if [ -z "${REPO}" -o ! -d "${REPO}" ]
|
||||
then
|
||||
echo 'No repo specified or no such repo';
|
||||
exit 3
|
||||
fi
|
||||
|
||||
cd "${REPO}" || exit 3
|
||||
|
||||
if [ -z "$(git ls-files --modified --deleted --others --exclude-standard)" ]
|
||||
then
|
||||
echo "No uncommited changes in ${REPO}"
|
||||
exit 0
|
||||
else
|
||||
echo "Uncommited changes in ${REPO}"
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user