Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Possible Duplicate:
Can I launch a graphical program on another user's desktop as root?

I wrote a script which starts from init.d .When it finishes I need it to notify-send a message to me (I am running GNOME). I tried

export DISPLAY=:0.0

but it doesn't help.

Is there any way to do this?

share|improve this question
1  
notify-send uses DBus, so you'll probably need to set the DBUS_SESSION_BUS_ADDRESS environment variable as well. –  jw013 Dec 29 '11 at 2:53
    
Here is an example script calling notify-send from udev hackaday.com/2009/09/18/how-to-write-udev-rules –  Grzegorz Wierzowiecki Aug 25 '12 at 9:05
add comment

marked as duplicate by Gilles, Mat, Michael Mrozek Feb 2 '12 at 19:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

The init script is running as root, your Gnome session most likely not.

You probably have to su - user 'DISPLAY=:0 notify-send "blah blah"'

share|improve this answer
add comment
export VARIABLE=value  # for Bourne, bash, and related shells
setenv VARIABLE value  # for csh and related shells
share|improve this answer
1  
This isn't even valid shell syntax, and what is it supposed to do anyway? –  Gilles Dec 28 '11 at 23:33
add comment