Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 have a python script that gets messages from an MQTT server and parses them to display using libnotify. This works fine when I run it from a terminal, but when I run it using upstart I get no notification bubbles. I assume because it doesn't understand which X display and Xauthority file to use.

When I did something similar with cron I had to set it up as */10 * * * * DISPLAY=:0.0 XAUTHORITY=~/.Xauthority notify-send "Don't forget" "you're awesome" I assume I need to do something similar with upstart to make this work? Or is there a way to get libnotify to broadcast to all xscreens or somesuch?

Thanks for any advice or pointers

share|improve this question
up vote 1 down vote accepted

Would you be better off approaching this problem from a different angle?

I'd try run your script on login by putting a .desktop file in ~/.config/autostart and ensure that the script restarts itself if there's a network problem (I assume that's why you're using upstart).

Something like this perhaps:

while 1:
    rc = 0
    while rc == 0:
        rc = client.loop()
    # Check error code, possibly pause for a while
share|improve this answer
The main reason I was using upstart was so I can use this in a standard deployment of machines to my dev team. Since there might be a couple of user accounts on a machine I was hoping to avoid per-user configs. If it comes to it it's not impossible however :) – daubers Dec 16 '11 at 13:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.