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, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2008 - Some Rights Reserved

About George Notaras

George Notaras is the editor of G-Loaded Journal, a technical blog about Free and Open-Source Software. George is a GNU/Linux enthusiast, a self-taught programmer and system administrator. He strongly believes that "knowledge is power" and 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 and spends some of his spare time developing open-source software. Follow George on Twitter: @gnotaras

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:

    #!/bin/bash
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/crn/bin
    export DISPLAY=:0.0
    export $(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep gnome-session)/environ )
    TIME=$1
    shift
    /usr/bin/notify-send -t 36000 $1 $2

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>