aboutsummaryrefslogtreecommitdiff
path: root/sysutils/cciss_vol_status/files
diff options
context:
space:
mode:
authorFlorian Smeets <flo@FreeBSD.org>2012-10-25 14:31:01 +0000
committerFlorian Smeets <flo@FreeBSD.org>2012-10-25 14:31:01 +0000
commit48a981de21f3e038c7cbe5cc8f0f763b61a54504 (patch)
tree0517dabbf320927ed5a7736b6049689af8c9d99e /sysutils/cciss_vol_status/files
parentcec58d5c205e886ef4864bb65899fef8de10ea23 (diff)
downloadports-48a981de21f3e038c7cbe5cc8f0f763b61a54504.tar.gz
ports-48a981de21f3e038c7cbe5cc8f0f763b61a54504.zip
Notes
Diffstat (limited to 'sysutils/cciss_vol_status/files')
-rw-r--r--sysutils/cciss_vol_status/files/cciss_vol_status.in58
1 files changed, 58 insertions, 0 deletions
diff --git a/sysutils/cciss_vol_status/files/cciss_vol_status.in b/sysutils/cciss_vol_status/files/cciss_vol_status.in
new file mode 100644
index 000000000000..efd920a90531
--- /dev/null
+++ b/sysutils/cciss_vol_status/files/cciss_vol_status.in
@@ -0,0 +1,58 @@
+#!/bin/sh
+# This is a script to test CISS volumes
+# Author: Leonid Nevecherya
+# Based on a script by Garrett Wollman. (ports/sysutils/smartmontools/files/smart.in as of 1.12 2011/12/01 20:53:31)
+#
+
+if [ -r /etc/defaults/periodic.conf ]; then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
+
+cciss_vol_status=%%PREFIX%%/bin/cciss_vol_status
+: ${daily_cciss_vol_status_flags="-s"}
+: ${daily_cciss_vol_status_extra_status_flags="-V"}
+
+case "${daily_cciss_vol_status_devices}" in
+ # AUTO mode selects all ciss disks
+ [Aa][Uu][Tt][Oo])
+ daily_cciss_vol_status_devices="$(ls /dev/ciss*)"
+ ;;
+ *) ;;
+esac
+
+if [ -z "${daily_cciss_vol_status_devices}" ]; then
+ : ${daily_cciss_vol_status_enable="NO"}
+else
+ : ${daily_cciss_vol_status_enable="YES"}
+fi
+
+tmpfile="$(mktemp -t daily)"
+trap "rm -f ${tmpfile}" 0 1 3 15
+
+rc=0
+case "${daily_cciss_vol_status_enable}" in
+ [Yy][Ee][Ss])
+ echo
+ echo 'CISS volumes status:'
+ cd /dev
+ for device in ${daily_cciss_vol_status_devices}; do
+ if [ -e ${device} ]; then
+ echo -n "Checking health of ${device}: "
+ ${cciss_vol_status} ${daily_cciss_vol_status_flags} \
+ ${device} > "${tmpfile}"
+ status=$?
+ if [ ${status} -eq 0 ]; then
+ echo "OK"
+ else
+ rc=1
+ ${cciss_vol_status} \
+ ${daily_cciss_vol_status_extra_status_flags} \
+ ${device}
+ fi
+ fi
+ done
+ ;;
+esac
+
+exit "${rc}"