[packages/monitoring-plugin-check_file_exists] also check if file is folder
glen
glen at pld-linux.org
Fri Jul 14 19:17:41 CEST 2017
commit 6b924c46f293446abdc84bc88c7795fd7e40dfb6
Author: Simon Smit <Simon.johannes.smit at gmail.com>
Date: Thu Jul 13 11:44:08 2017 +0200
also check if file is folder
check_file_exists.sh | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/check_file_exists.sh b/check_file_exists.sh
index 35ac363..77a0222 100755
--- a/check_file_exists.sh
+++ b/check_file_exists.sh
@@ -35,6 +35,11 @@ exists() {
echo "$(state_name): $1 EXISTS :: `head -3 $1`" # shows the first three lines of the file
}
+exists_dir() {
+ $negate && STATE=$STATE_CRITICAL || STATE=$STATE_OK
+ echo "$(state_name): $1 EXISTS :: Directory" # don't show the first three lines of the file
+}
+
not_exists() {
$negate && STATE=$STATE_OK || STATE=$STATE_CRITICAL
echo "$(state_name): $1 Does NOT exist"
@@ -71,6 +76,8 @@ fi
if [ -f "$1" ]; then
exists "$1"
+elif [ -d "$1" ]; then
+ exists_dir "$1"
else
not_exists "$1"
fi
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/monitoring-plugin-check_file_exists.git/commitdiff/2b09a5770c85c6703bf9a6b7960710e980536b2d
More information about the pld-cvs-commit
mailing list