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
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