John Hart
2015-Sep-22 13:56 UTC
[Nut-upsdev] NOTIFYCMD shell script problem driving me NUTS
Either I am missing something or I am really STUPID. 1. I have added a user, named nutmon, to the nut group. 2. In upsmon.conf I have set RUN_AS_USER nutmon . 3. I have NOTIFYCMD /etc/nut/notifyme.sh and it is set as 755, so should be executable by everyone. 4. I have the NOTIFYFLAG set as SYSLOG+WALL+EXEC, so the shell should execute. This is the shell script : #!/bin/bash # # NUT NOTIFYCMD script PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin notify-send --expire-time=1 "$*" If I execute the script form a terminal as user john (that's me) the script works as desired and I get on screen notification. However, if I execute the script as root, nothing happens. Also, I do not get any on screen notifications from upsmon . If I have a terminal open and unplug the UPS I get broadcast messages to the terminal. I have reloaded everything after making changes. What am I doing wrong? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20150922/79dd1c94/attachment.html>
Thomas Charron
2015-Sep-22 15:27 UTC
[Nut-upsdev] NOTIFYCMD shell script problem driving me NUTS
On Tue, Sep 22, 2015 at 9:56 AM, John Hart <jsamcr at gmail.com> wrote:> notify-sendnotify-send needs a DBUS_SESSION_BUS_ADRESS to work right. Look around for code snippets to get this. -- -- Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20150922/0af9fc76/attachment.html>
Charles Lepple
2015-Sep-23 12:37 UTC
[Nut-upsdev] NOTIFYCMD shell script problem driving me NUTS
On Sep 22, 2015, at 11:27 AM, Thomas Charron <twaffle at gmail.com> wrote:> > On Tue, Sep 22, 2015 at 9:56 AM, John Hart <jsamcr at gmail.com> wrote: >> notify-send > > notify-send needs a DBUS_SESSION_BUS_ADRESS to work right. Look around for code snippets to get this.Ah, that notify-send. Another option is to launch the PyNUT app in your xsession (or equivalent) - it will also display GUI notifications. In Debian, it is in the package "nut-monitor". I haven't used this personally, though. Either way, please let us know what we can do to expand the NUT documentation on this topic. -- Charles Lepple clepple at gmail