Sign up ×
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.

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 –  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 '14 at 8:57

1 Answer 1

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 '14 at 9:01