> If notify-send is available on the Mac, then perhaps this will work:

It is not installed. 

> In upsmon.conf on the Mac you need
> 
> NOTIFYCMD /usr/sbin/upssched        (or wherever this goes on a Mac)
> NOTIFYFLAG ONBATT SYSLOG+EXEC

Mac  /sw/etc/nut/upsmon.conf, I have FINK installed on Mac. 
http://www.finkproject.org

NOTIFYCMD /sw/sbin/upssched
NOTIFYFLAG ONBATT SYSLOG+EXEC

Mac /sw/etc/nut/upssched.conf: 

CMDSCRIPT /sw/bin/upssched-cmd
PIPEFN /sw/var/run/ups/upssched/upssched.pipe
LOCKFN /sw/var/run/ups/upssched/upssched.lock
AT ONBATT ups@<ip address> EXECUTE on-battery

Mac /sw/bin/upssched-cmd:

case $1 in
        upsgone)
                logger -t upssched-cmd "The UPS has been gone for awhile"
                ;;

        on-battery)
                osascript -e 'tell app "System Events" to display dialog  
"Power failure. Save your work" giving up after 20 buttons {"OK"} default 
button 1 with icon caution'
                ;;
                        
        *)
                logger -t upssched-cmd "Unrecognized command: $1"
                ;;
esac


This is working and showing a box with an ok button which disappears after a 
while. With the same command osascript it should be possible to send an message 
to a mobile phone. 

Thanks ! 


Kind Regards,

Rob



> On 10 Jun 2017, at 10:02, Roger Price <ro...@rogerprice.org> wrote:
> 
> On Fri, 9 Jun 2017, Robbie van der Walle wrote:
> 
>> ... and also still open is the notification on the Mac.
> 
> If notify-send is available on the Mac, then perhaps this will work:
> 
> In upsmon.conf on the Mac you need
> 
> NOTIFYCMD /usr/sbin/upssched        (or wherever this goes on a Mac)
> NOTIFYFLAG ONBATT SYSLOG+EXEC
> 
> In upssched.conf you need
> 
> CMDSCRIPT /usr/sbin/upssched-cmd    (or wherever this goes on a Mac)
> AT ONBATT UPS@NAS EXECUTE on-battery
> 
> In upssched-cmd you need
> 
> case $1 in
>   (on-battery) MSG="Power failure. Save your work!"
>                notify-send -a nut -u critical -t 600000 $MSG ;;
>   (*) logger -i -t upssched-cmd "Unrecognized command: \"$1\"." ;;
> esac
> 
> Roger
> 
> _______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser@lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser

Reply via email to