[packages/nagios-plugin-check_vserver_count] load util-vserver-vars to locate confdir path

glen glen at pld-linux.org
Sat Sep 29 11:30:38 CEST 2012


commit 4a419d2c064ee7f13b70736319cfa88951c63070
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat Sep 29 12:30:26 2012 +0300

    load util-vserver-vars to locate confdir path

 check_vserver_count.sh | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/check_vserver_count.sh b/check_vserver_count.sh
index fc67661..33d02d4 100755
--- a/check_vserver_count.sh
+++ b/check_vserver_count.sh
@@ -1,9 +1,19 @@
 #!/bin/sh
-shouldrun=$(grep . /etc/vservers/*/apps/init/mark |wc -l)
+
+[ -n "$UTIL_VSERVER_VARS" ] || {
+	UTIL_VSERVER_VARS=/usr/lib64/util-vserver/util-vserver-vars
+	[ -e "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars
+}
+if [ ! -e "$UTIL_VSERVER_VARS" ] ; then
+	echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
+	exit 1
+fi
+. "$UTIL_VSERVER_VARS"
+
+shouldrun=$(grep . $__CONFDIR/*/apps/init/mark | wc -l)
 running=$(awk '/Active/{ print $2 }' /proc/virtual/status)
 
-if [ $shouldrun = $running ]
-then
+if [ $shouldrun = $running ]; then
 	echo "OK: running $running out of $shouldrun vservers"
 	exit 0
 else
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nagios-plugin-check_vserver_count.git/commitdiff/4a419d2c064ee7f13b70736319cfa88951c63070



More information about the pld-cvs-commit mailing list