Date: Mon, 8 Oct 2012 13:35:56 GMT From: Leonid Nevecherya <nlv@imbera.ru> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/172486: [patch] sysutils/cciss_vol_status: Add daily periodic script Message-ID: <201210081335.q98DZuuq051922@red.freebsd.org> Resent-Message-ID: <201210081340.q98De6Q2053715@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 172486 >Category: ports >Synopsis: [patch] sysutils/cciss_vol_status: Add daily periodic script >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Oct 08 13:40:06 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Leonid Nevecherya >Release: >Organization: >Environment: FreeBSD XXXX 8.3-RELEASE-p3 FreeBSD 8.3-RELEASE-p3 >Description: Add daily periodic script cciss_vol_status. Script have parameters daily_cciss_vol_status_flags="-s" Default check SMART status of array disks, daily_cciss_vol_status_extra_status_flags="-V" Default full programm output on problem array, daily_cciss_vol_status_devices This is list of ciss devices to monitor or AUTO to monitor all devices. >How-To-Repeat: >Fix: Patch attached with submission follows: diff -ruN /usr/ports/sysutils/cciss_vol_status/Makefile sysutils/cciss_vol_status/Makefile --- /usr/ports/sysutils/cciss_vol_status/Makefile 2012-08-20 20:03:59.000000000 +0400 +++ sysutils/cciss_vol_status/Makefile 2012-10-08 17:21:38.000000000 +0400 @@ -7,6 +7,7 @@ PORTNAME= cciss_vol_status PORTVERSION= 1.10 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= SF/cciss/${PORTNAME} @@ -27,4 +28,8 @@ 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 -ruN /usr/ports/sysutils/cciss_vol_status/files/cciss_vol_status.in sysutils/cciss_vol_status/files/cciss_vol_status.in --- /usr/ports/sysutils/cciss_vol_status/files/cciss_vol_status.in 1970-01-01 03:00:00.000000000 +0300 +++ sysutils/cciss_vol_status/files/cciss_vol_status.in 2012-10-08 17:13:55.000000000 +0400 @@ -0,0 +1,60 @@ +#!/bin/sh +# This is script to test CISS volumes +# Author: Leonid Nevecherya +# Maked from smart check script by original author: Garrett Wollman. $FreeBSD: ports/sysutils/smartmontools/files/smart.in,v 1.12 2011/12/01 20:53:31 dinoex Exp $ +# + + +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 + # XXX AUTO mode selects only regular ad/da 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}" diff -ruN /usr/ports/sysutils/cciss_vol_status/pkg-plist sysutils/cciss_vol_status/pkg-plist --- /usr/ports/sysutils/cciss_vol_status/pkg-plist 1970-01-01 03:00:00.000000000 +0300 +++ sysutils/cciss_vol_status/pkg-plist 2012-10-08 17:25:36.000000000 +0400 @@ -0,0 +1,4 @@ +etc/periodic/daily/cciss_vol_status +bin/cciss_vol_status +@dirrmtry etc/periodic/daily +@dirrmtry etc/periodic >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210081335.q98DZuuq051922>