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

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  
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
1  
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
    
Another example is under the question How to make notify-send work on /etc/init.d/a_script –  pabouk Nov 8 at 8:57

2 Answers 2

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
    
notify-send does not communicate directly with X Server so it does not need the DISPLAY variable. It communicates over D-Bus so it needs DBUS_SESSION_BUS_ADDRESS variable. –  pabouk Nov 8 at 9:01
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