Towards the resolution of the issues with libnotify

A while ago, I had written about some problems I had encountered while trying to send notification messages with libnotify to the logged-in users’ desktops from a cronjob. Although I haven’t made any progress with that issue, I just noticed a very useful comment under that post, submitted by Aleksei. According to the tip, sudo can be used in order to actually send the notification as the user that is currently using the desktop, for example: sudo -u $USER notify-send ... The $USER can be easily retrieved by the cronjob from the /proc/$PID/environ path. I am not able to test this at the moment, but will do (time permitting). Apart from this possible workaround with sudo, I assume that the current dbus security configuration does not permit the sending of messages using notify-send as I had described in that previous article. Anyhow, not only I do not have the necessary free time to study dbus‘ security mechanism, but, frankly, I do not wish to learn about it at the current time.

Towards the resolution of the issues with libnotify by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2008 - Some Rights Reserved

George Notaras avatar

About George Notaras

George Notaras is the editor of the G-Loaded Journal, a technical blog about Free and Open-Source Software. George, among other things, is an enthusiast self-taught GNU/Linux system administrator. He has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora. He has also developed some open-source software projects in his spare time.

One response on “Towards the resolution of the issues with libnotify

  1. chris Permalink →

    hello there

    tnx for the solution, i did these script to send automated notify-messages:

    export DISPLAY=:0.0
    export $(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep gnome-session)/environ )
    /usr/bin/notify-send -t 36000 $1 $2