[packages/monitoring-plugin-check_file_exists] release 1.2
glen
glen at pld-linux.org
Fri Jul 14 19:17:46 CEST 2017
commit 2b09a5770c85c6703bf9a6b7960710e980536b2d
Author: Elan Ruusamäe <glen at pld-linux.org>
Date: Fri Jul 14 20:17:22 2017 +0300
release 1.2
check_file_exists.sh | 14 ++++++++------
monitoring-plugin-check_file_exists.spec | 2 +-
2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/monitoring-plugin-check_file_exists.spec b/monitoring-plugin-check_file_exists.spec
index 20ee9d8..ba14d33 100644
--- a/monitoring-plugin-check_file_exists.spec
+++ b/monitoring-plugin-check_file_exists.spec
@@ -1,7 +1,7 @@
%define plugin check_file_exists
Summary: Monitoring plugin to check if a file exists or not
Name: monitoring-plugin-%{plugin}
-Version: 1.1
+Version: 1.2
Release: 1
License: GPL
Group: Networking
diff --git a/check_file_exists.sh b/check_file_exists.sh
index 77a0222..2afd5c1 100755
--- a/check_file_exists.sh
+++ b/check_file_exists.sh
@@ -3,8 +3,9 @@
# Author : Diego Martin Gardella [dgardella at gmail.com]
# Desc : Plugin to verify if a file exists
#
-# v1.0: Initial version by Diego Martin Gardella [dgardella at gmail.com]
-# v1.1: Add negate support, by Elan Ruusamäe <glen at pld-linux.org>
+# v1.0: Initial version by (Diego Martin Gardella [dgardella at gmail.com])
+# v1.1: Add negate support (Elan Ruusamäe <glen at pld-linux.org>)
+# v1.2: Also check if file is folder (Simon Smit)
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
@@ -32,12 +33,13 @@ state_name() {
exists() {
$negate && STATE=$STATE_CRITICAL || STATE=$STATE_OK
- echo "$(state_name): $1 EXISTS :: `head -3 $1`" # shows the first three lines of the file
+ # shows the first three lines of the file
+ echo "$(state_name): $1 EXISTS :: `head -3 $1`"
}
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
+ $negate && STATE=$STATE_CRITICAL || STATE=$STATE_OK
+ echo "$(state_name): $1 EXISTS :: Directory"
}
not_exists() {
@@ -77,7 +79,7 @@ fi
if [ -f "$1" ]; then
exists "$1"
elif [ -d "$1" ]; then
- exists_dir "$1"
+ 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