Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 was marked as an exact duplicate of an existing 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 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 '14 at 8:57

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