<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Yes you r absolutely right, its kind of hackish and not
architectural correct.<br>
I did something (simple but suits my needs for now) in python that
gets executed from gnome.<br>
Here it is if someone is interested in knowing the state of some
services at specified intervals<br>
#######<br>
import dbus<br>
from dbus import SystemBus,Interface<br>
from gi.repository import Notify, GObject<br>
from time import sleep<br>
import threading;<br>
<br>
class DbusNotify():<br>
def __init__(self):<br>
pass<br>
def doRun(self):<br>
threading.Timer(1200, self.doRun).start ();<br>
bus = SystemBus()<br>
systemd =
bus.get_object('org.freedesktop.systemd1','/org/freedesktop/systemd1')<br>
manager = Interface(systemd,
dbus_interface='org.freedesktop.systemd1.Manager')<br>
array=["iptables.service","rc-local.service","polkit.service","systemd-logind.service","systemd-udevd.service","rpcgssd.service"]<br>
try:<br>
for a in array:<br>
getUnit=manager.GetUnitFileState(a);<br>
status= a + " status: %s" % getUnit<br>
Notify.init("myapp_name")<br>
n = Notify.Notification.new("systemd", status)<br>
n.show()<br>
except Exception as e:<br>
raise<br>
<br>
notif=DbusNotify()<br>
notif.doRun()<br>
#######<br>
<div class="moz-cite-prefix">On 02/07/2015 06:15 PM, Mantas
Mikulėnas wrote:<br>
</div>
<blockquote
cite="mid:CAPWNY8VsYaW0-RXZOeiC5+=F3_AFaRDOMWYsMfhKmOY7F0zpHw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Sat, Feb 7, 2015 at 1:32 AM,
George Karakougioumtzis <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:mad-proffessor@hotmail.com" target="_blank">mad-proffessor@hotmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> Interesting point,
thanks for the clarifications. I thought that it would
be as simple as setting the environmental variables
DBUS_SESSION_BUS_ADRESS and DISPLAY at each unit file
that you would want to receive notifications from.</div>
</blockquote>
<div><br>
</div>
<div>At a technical level, yes, notify-send only needs one
of them to connect to D-Bus.</div>
<div><br>
</div>
<div>But beyond that, I am not going to touch <i>anything</i>
that assumes one user, one session, one unchanging
display, and one unchanging session bus path. (You <i>could</i>
hardcode DISPLAY=:0, but there's no guarantee that it will
still be :0 the next time – even on single-user systems
I've seen Xorg crash, leaving :0 locked, and restarting at
:1 or :2.) If you like such hacks, feel free to – systemd
will not stop you. You can even use EnvironmentFile=.</div>
<div><br>
</div>
<div>Perhaps it will change in the future. When the "user
bus" is implemented in the upcoming months, this task
will, hopefully, become a simple matter of contacting
/run/user/$UID/bus for each logged in user.</div>
<div><br>
</div>
<div>(It's odd; people always complain that systemd forgets
Unix, but they themselves forget that Unix was a <i>massively</i> multi-user
system... Hell, even my old WinXP desktop spent most of
this time with two people using it <i>at once</i>; one
locally, one over RDP.)</div>
</div>
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">Mantas Mikulėnas <<a
moz-do-not-send="true" href="mailto:grawity@gmail.com"
target="_blank">grawity@gmail.com</a>></div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>