[Nut-upsuser] Variable use in upssched-cmd

Charles Lepple clepple at gmail.com
Thu Nov 6 03:57:10 UTC 2008


On Wed, Nov 5, 2008 at 11:53 AM, tarbeite <tarbeite at fit.edu> wrote:
>
> Thanks for the quick response, it pointed me in the right direction.
> I apologize for my ignorance but I'm still a novice in Linux. My question is
> how can this code below be accomplished using the variables mentioned by
> Arjen?
>
> ec228_commbad)
> Echo "ec228 communications are bad" \
> | mailx -r "ups at fit.edu" -s"EC228 cmm is bad" admin at email.com
> ;;

You could do something like the following:

case "$NOTIFYTYPE" in
    commbad) SUBJECT="communications went bad" ;;
...
    *) SUBJECT="($NOTIFYTYPE)"
esac

echo "$UPSNAME $SUBJECT" | mailx ...

(but I haven't really had a need to use upssched, so take that with a
grain of salt)

> On 11/5/08 12:58 AM, "Charles Lepple" <clepple at gmail.com> wrote:
>
>> On Tue, Nov 4, 2008 at 12:47 PM, tarbeite <tarbeite at fit.edu> wrote:
>>> Hi all
>>>
>>> I have most of the NUT system up and running. I'm in the process of writing
>>> the script to send email notifications for certain events. This is my
>>> upsshed-cmd file so far:
>>>
>>> # EC130 Commands
>>>
>>>         ec130onbatt)
>>>                 echo "EC130 UPS has been on Battery for more then 10
>>> seconds" \
>>>                 | mailx -r "ups at fit.edu" -s"EC130 on battery"
>>> tarbeite at fit.edu
>>>                 ;;
>>>         ec130combad)
>>>                 echo "Communications to EC130 UPS have degraded." \
>>>                 | mailx -r "ups at fit.edu" -s"EC130 bad Communications"
>>> tarbeite at fit.edu
>>
>> As an aside, you can use wildcards in case statements. I think the
>> variables that Arjen pointed out should help, though.
>
>
> _______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser
>



-- 
- Charles Lepple



More information about the Nut-upsuser mailing list