#!/bin/sh # check for APC UPS with delayed shutdown # return 0 if no delay and delay time if exist UPSLIST="SMART-UPS" COUNT=`/usr/sbin/apcaccess|/bin/egrep -i -e "$UPSLIST"|wc -l` if [ $[ $COUNT > 0 ] == 1 ]; then DELAY=`/usr/sbin/apcaccess|/bin/grep DSHUTD|/bin/sed -e "s/.*: 0*\([0-9]*\) .*/\1/"` else DELAY=0 fi echo $DELAY exit $DELAY