diff --git a/README.md b/README.md index b35d988f3a29b02fcaea3c30f791cceb517bad25..cc9a4e9478ebedabf242e8ecc6c0393d17a4fa45 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,13 @@ ## List of Local scripts Local scripts are located in /usr/lib/check_mk/local/ +### git_pull_check.sh +* Attributes to be filled: +<pre> +# List of paths to check separated by space +paths="" +</pre> + ## List of plugins Local scripts are located in /usr/lib/check_mk/plugins/ \ No newline at end of file diff --git a/git_pull_check.sh b/git_pull_check.sh new file mode 100755 index 0000000000000000000000000000000000000000..7b14a9d3aec795f4e153d6d50cbebe347fcc21d2 --- /dev/null +++ b/git_pull_check.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# List of paths to check separated by space +paths="" + +for path in $paths +do + if [[ -d $path ]]; then + cd $path + result=$(git fetch --dry-run 2>&1) + if [[ -n $result ]] ; then + status=1 + statustxt="WARNING - There are available new commits" + else + status=0 + statustxt="OK" + fi + else + status=2 + statustxt="CRITICAL - Directory does not exist" + fi + echo "$status git_pull_check_dir=$path - $statustxt" +done