Hi, on Ubuntu 8/9, i'm trying to write a daemon in python, that monitors a certain network condition and informs the user using a gtk.messagedialog. I installed this script using rc-update. The daemon starts at boot, but doesn't show the dialog even after I login. I assume because init.d starts my daemon at tty1 and no gnome is available. Tried running the dialog through a subprocess, but it seems to inherit the same run environment. Whats the best practice for this sort of thing.
It does work when GNOME is running. Zenity is "ok", if it works, and I don't think it will, because it is the same problem, there is no GNOME when I'll call it with python.
If five users are logged in to X sessions, who gets the message? Everyone?
If someone is logged in locally but only using the tty, and not X11, should they see the message?
If someone is logged in remotely via ssh -X to run a graphic application on their own system off of your CPU, should they see the message? How would you get it to them?
Linux is too flexible for your current approach. The standard way to do this is for any user who is interested in the kind of message you are sending to run an application that receives the message and displays it in a way of its choosing. Dbus is a popular way of setting up the messaging process. This way remote users or users logged in with TTY mode only still have an option for seeing the message.
You may use notify-send
(from libnotify-bin
package) to send notifications to desktop users from your daemon.