]> arthur.barton.de Git - nagcollect.git/commitdiff
RAID.tst: use screen(1) so that promiseutil(8) has a valid tty
authorAlexander Barton <alex@barton.de>
Wed, 22 Aug 2012 13:57:44 +0000 (15:57 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 22 Aug 2012 13:57:44 +0000 (15:57 +0200)
promiseutil(8) fails to run when it has no valid terminal, for example
when using ssh. So we run it inside a screen(1) session now ...

client/lib/tests/RAID.tst

index 51c785ce032b60225763faaaf9d80e2f767b265e..859062b1280a914b7b7f3f6f3e05756b26178c07 100644 (file)
@@ -5,6 +5,7 @@ SERVICE="RAID_p"
 
 if [ `uname` = "Darwin" ]; then
        tmp=`mktemp "/tmp/$$.XXXX"`
+       tmp2=`mktemp "/tmp/$$-2.XXXX"`
        LC_ALL=C diskutil checkRAID >"$tmp" 2>/dev/null
        if [ $? -eq 0 ]; then
                # Apple Software-RAID detected
@@ -46,8 +47,8 @@ if [ `uname` = "Darwin" ]; then
                        TEXT="$TEXT  Apple HW-RAID status is unknown ($status)!?"
                fi
        fi
-       LC_ALL=C promiseutil -C array -a list -v 2>/dev/null </dev/tty \
-         | grep -A8 '^LdId' | grep '^[0-9]' >"$tmp"
+       LC_ALL=C screen -D -m sh -c "promiseutil -C array -a list -v >$tmp2"
+        grep -A8 '^LdId' "$tmp2" | grep '^[0-9]' >"$tmp"
        if [ $? -eq 0 ]; then
                # Promise Hardware-RAID detected
                declare -i good=0
@@ -73,7 +74,7 @@ if [ `uname` = "Darwin" ]; then
                        TEXT="$TEXT  Promise HW-RAID status is unknown ($status)!?"
                fi
        fi
-       rm -f "$tmp"
+       rm -f "$tmp" "$tmp2"
 elif [ `uname` = "Linux" -a -r /proc/mdstat ]; then
        status=$(cat /proc/mdstat | grep -E "(^md|^      [0-9])" \
         | while read info1; do