Super User is a question and answer site for computer enthusiasts and power users. 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

I am trying to get cron to provide a screen alert when it spots a particular situation. I know the script is executed each minute but it will not display on the screen.

script executed is:

DISPLAY=:0.0 /usr/bin/notify-send -t 1000 Test "This is a test"

Running Gnome from the Mandriva distribution.

Any ideas?

share|improve this question
Another way to do it… – akond Jul 20 '12 at 11:46

Is this your user's crontab, not root's crontab?

I'd suggest that, at least for debugging, you create a script as John T describes:

* * * * * /path/to/

Here's what the script might look like:

    echo "trying to notify at $(date)"
    DISPLAY=:0.0 /usr/bin/notify-send -t 1000 Test "This is a test"
    echo "finished notify at $(date)"
} > /path/to/your-notify-debug.log 2>&1

Note that there's no ":" before DISPLAY, as you seem to have in your question. Be sure to make this script executable (chmod +x /path/to/ and let cron try to run it a few times. Then examine what was written to the logfile.

share|improve this answer

You need to be able to connect to the DBUS user session bus. This needs to be the session bus not the system bus. You can find that by doing a


then in your script you need to have

export DBUS_SESSION_BUS_ADDRESS={whatever it is}

then do your notify-send

Since the session bus changes every time you login, you might want to add something to your login scripts to write the DBUS_SESSION_BUS_ADDRESS to a file so your script can read that in and export that.

share|improve this answer
It may have already been saved to a file. Try using this at the start of your script: if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]]; then source "$HOME/.dbus/session-bus"/*-0 && export DBUS_SESSION_BUS_ADDRESS; fi – dubiousjim Feb 28 '10 at 13:21

You must log in to answer this question.