aboutsummaryrefslogtreecommitdiff
path: root/sysutils
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
parentcec58d5c205e886ef4864bb65899fef8de10ea23 (diff)
downloadports-48a981de21f3e038c7cbe5cc8f0f763b61a54504.tar.gz
ports-48a981de21f3e038c7cbe5cc8f0f763b61a54504.zip
Notes
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/cciss_vol_status/Makefile15
-rw-r--r--sysutils/cciss_vol_status/files/cciss_vol_status.in58
2 files changed, 67 insertions, 6 deletions
diff --git a/sysutils/cciss_vol_status/Makefile b/sysutils/cciss_vol_status/Makefile
index ef1f63d16bb3..ea20d072a3b4 100644
--- a/sysutils/cciss_vol_status/Makefile
+++ b/sysutils/cciss_vol_status/Makefile
@@ -1,12 +1,9 @@
-# New ports collection makefile for: cciss_vol_status
-# Date created: 7 Sep 2007
-# Whom: mm
-#
+# Created by: mm
# $FreeBSD$
-#
PORTNAME= cciss_vol_status
PORTVERSION= 1.10
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= SF/cciss/${PORTNAME}
@@ -19,7 +16,9 @@ LICENSE_FILE= ${WRKSRC}/COPYING
GNU_CONFIGURE= yes
MAN8= cciss_vol_status.8
-PLIST_FILES= bin/cciss_vol_status
+PLIST_FILES= bin/cciss_vol_status etc/periodic/daily/cciss_vol_status
+PLIST_DIRS= etc/periodic/daily etc/periodic
+SUB_FILES= cciss_vol_status
.include <bsd.port.pre.mk>
@@ -27,4 +26,8 @@ PLIST_FILES= bin/cciss_vol_status
IGNORE= cciss_vol_status requires kernel sources of the ciss driver
.endif
+post-install:
+ ${MKDIR} ${PREFIX}/etc/periodic/daily
+ ${INSTALL_SCRIPT} ${WRKDIR}/cciss_vol_status ${PREFIX}/etc/periodic/daily/cciss_vol_status
+
.include <bsd.port.post.mk>
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}"