Hi,
I have a simple python program that takes backups. It calls rsnapshot, but
the python program does 2 things
A) It checks if mij external drive is mounted, if not it uses
gio.VolumeMonitor to detect mounting, and if the correct one is mounted it
proceeds
B) uses pynotify to give notifications (External drive is not mounted,
taking backup, ...).
This works perfectly when I'm logged in (in X), and starting the program in
gnome-terminal.
When I try this in a cronjob (using DISPLAY=:0, which is not foolproof but
works for me in 99.99999% of the cases), and setting the correct dbus
session vars with
"
for file in `ls -1tr ~/.dbus/session-bus/`; do
source ~/.dbus/session-bus/"$file"
done
"
this does NOT work. I see the notifications (dbus seems working), but the
mount-added signal from VolumeMonitor is never received.
Also when I try this in a virtual-terminal (ctrl-alf-f2), it doesn't work
(same problem, notifications are working, mount-added signal is not).
So: what is the difference between a virtual-terminal and cronjob on the one
side, and X (gnome-terminal) on the other side when the correct environment
variables are set?
I'am using glib 2.28.8 from Fedora 15.
When I still was using Ubuntu 11.04 with glib 2.28.6 this was working perfectly, which makes me quite confident that I'm not really at fault.
Can their be a change between .6 and .8 that causes this (I checked the ChangeLog but didn't find anything alarming, but that is just me)
And what is the difference between Ubuntu and Fedora except for the glib version?
( I know the gtk+ list is probably not the best list to ask this, but I already have posted this on a fedora list but noone answers it)
I personally could only think of one difference between ubuntu and fedora and that is selinux, but I
disabled that with "setenforce 0", and that didn't help.
So Does anyone have an idea what the problem is, and how I can solve it?
(One idea could be to not use VolumeMonitor, but a while loop that checks
availability, but that does seem to be a nasty hack).
monitor = gio.VolumeMonitor()
monitor.connect('mount-added', self.on_mount)
loop = glib.Mainloop()to set it all going...
loop.run ()