Passing a notification from root to user with notification-daemon

View: New views
5 Messages — Rating Filter:   Alert me  

Passing a notification from root to user with notification-daemon

by Brian Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

This may not be the right place for this, but here goes:

I am developing an excruciatingly small program that passes
notifications of possible hard disk issues from smartd to the
user. It looks like the notification-daemon might be the right thing to
use.

But I fail to find in the documentation how to pass a notification from
the root to the user context? Is there a "Right Way"? Could someone
point me in the right direction?

--
Brian Sutherland

Metropolis - "it's the first movie with a robot. And she's a woman.
              And she's EVIL!!"
_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel

Re: Passing a notification from root to user with notification-daemon

by Christian Hammond-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Mar 10, 2006 at 06:46:14PM +0100, Brian Sutherland wrote:

> Hi,
>
> This may not be the right place for this, but here goes:
>
> I am developing an excruciatingly small program that passes
> notifications of possible hard disk issues from smartd to the
> user. It looks like the notification-daemon might be the right thing to
> use.
>
> But I fail to find in the documentation how to pass a notification from
> the root to the user context? Is there a "Right Way"? Could someone
> point me in the right direction?
Unfortunately, there is no "right way." You would have to talk to the
user's session bus (or all users' session busses). That's more of a
general D-BUS issue rather than a notification issue. Now, we could
extend the notification framework to also listen on the system bus,
but that's tricky and requires a lot more thought. For the time-being,
I don't have a good answer for you, except find a way to listen to the
notifications (per-user) and then emit a notification. So, a proxy of
sorts for this specific case.

Christian
 
--
Christian Hammond         <>  The Galago Project
chipx86@...       <>  http://www.galago-project.org
   There is no limit to stupidity.  Space itself is said to be bounded
   by its own curvature, but stupidity continues beyond infinity.
       -- Gene Wolfe


_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel

signature.asc (196 bytes) Download Attachment

Re: Passing a notification from root to user with notification-daemon

by Brian Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Mar 12, 2006 at 11:29:46PM -0800, Christian Hammond wrote:

> On Fri, Mar 10, 2006 at 06:46:14PM +0100, Brian Sutherland wrote:
> > Hi,
> >
> > This may not be the right place for this, but here goes:
> >
> > I am developing an excruciatingly small program that passes
> > notifications of possible hard disk issues from smartd to the
> > user. It looks like the notification-daemon might be the right thing to
> > use.
> >
> > But I fail to find in the documentation how to pass a notification from
> > the root to the user context? Is there a "Right Way"? Could someone
> > point me in the right direction?
>
> Unfortunately, there is no "right way." You would have to talk to the
> user's session bus (or all users' session busses). That's more of a
> general D-BUS issue rather than a notification issue. Now, we could
> extend the notification framework to also listen on the system bus,
> but that's tricky and requires a lot more thought.

That's kind of what I have right now, I run a per-user-session-daemon
that listens to the system bus. But I agree it is tricky and would love
to move to a solution where the trickiness is handled for me.

> For the time-being,
> I don't have a good answer for you, except find a way to listen to the
> notifications (per-user) and then emit a notification. So, a proxy of
> sorts for this specific case.

This sets off my in-built complexity meter;)

Thanks for the reply, even a negative result is useful sometimes...

--
Brian Sutherland

Metropolis - "it's the first movie with a robot. And she's a woman.
              And she's EVIL!!"
_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel

Re: Passing a notification from root to user with notification-daemon

by Marco-52 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Brian Sutherland <jinty <at> web.de> writes:

>
> On Sun, Mar 12, 2006 at 11:29:46PM -0800, Christian Hammond wrote:
> > On Fri, Mar 10, 2006 at 06:46:14PM +0100, Brian Sutherland wrote:
> > > Hi,
> > >
> > > This may not be the right place for this, but here goes:
> > >
> > > I am developing an excruciatingly small program that passes
> > > notifications of possible hard disk issues from smartd to the
> > > user. It looks like the notification-daemon might be the right thing to
> > > use.
> > >
> > > But I fail to find in the documentation how to pass a notification from
> > > the root to the user context? Is there a "Right Way"? Could someone
> > > point me in the right direction?
> >
> > Unfortunately, there is no "right way." You would have to talk to the
> > user's session bus (or all users' session busses). That's more of a
> > general D-BUS issue rather than a notification issue. Now, we could
> > extend the notification framework to also listen on the system bus,
> > but that's tricky and requires a lot more thought.
>
> That's kind of what I have right now, I run a per-user-session-daemon
> that listens to the system bus. But I agree it is tricky and would love
> to move to a solution where the trickiness is handled for me.
>
> > For the time-being,
> > I don't have a good answer for you, except find a way to listen to the
> > notifications (per-user) and then emit a notification. So, a proxy of
> > sorts for this specific case.
>
> This sets off my in-built complexity meter;)
>
> Thanks for the reply, even a negative result is useful sometimes...
>
I have the same problem.
I'm coding a shell script to notify me when ppp0 is up but it don't work if root:
# /etc/ppp/ip-up.d/90ppp-connect
libnotify-Message: Unable to get session bus: Did not receive a reply. Possible
causes include: the remote application did not send a reply, the message bus
security policy blocked the reply, the reply timeout expired, or the network
connection was broken.
unix:abstract=/tmp/dbus-MTlwZSeoD5,guid=f404e303bbfed9dea1500c0046128b75

(it works as expected)

file: /etc/ppp/ip-up.d/90ppp-connect:

#!/bin/bash
title="Conectado"
text="$(tail -1 /var/log/ppp-connect-errors)"
pids=`pgrep gnome-session`
for pid in $pids; do
        # find DBUS session bus for this session
        DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS \
                /proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'`
        # use it
        DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \
        notify-send -u low "$title" "$text"
        echo $DBUS_SESSION_BUS_ADDRESS
done




_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel

Re: Re: Passing a notification from root to user with notification-daemon

by Kalle Vahlman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2007/4/4, Marco <marcodefreitas@...>:

> > > For the time-being,
> > > I don't have a good answer for you, except find a way to listen to the
> > > notifications (per-user) and then emit a notification. So, a proxy of
> > > sorts for this specific case.
> >
> > This sets off my in-built complexity meter;)
> >
> > Thanks for the reply, even a negative result is useful sometimes...
> >
> I have the same problem.
> I'm coding a shell script to notify me when ppp0 is up but it don't work if root:

I was hacking emerge to get notifications from it the other day and
had to have DISPLAY set to be able to send notifications from root to
user session bus, but after setting that it did work.

I'm not sure which of the systems (d-bus, libnotify, ...) required that though.

--
Kalle Vahlman, zuh@...
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel