[Nautilus-list] Launching Nautilus on USB Hotplug Notification



Hello,

I have USB hotplugging set up on my machine 
so that pictures are automatically downloaded
from my camera (via jphoto) when I plug it in.

I would like to have the script that is run
when hotplug detects my camera launch nautilus
as well, as it is my image browser of choice.

Hotplugging scripts are run as root, so I have
the following line to launch nautilus:

su - ryan -c "nautilus --display=:0.0 > /home/ryan/nautilus.log 2>&1" &

This works if I just run the script as root,
but it doesn't work when the script is initiated
buy the actual hotplugging (kernel calls 
/sbin/hotplug).

If I replace "nautilus" above with some other
GUI app (say, "eog"), it works. Only nautilus
seems to fail, with no output to either stdout
or stderr.

Does nautilus depend on some environment variable
that might not be getting set? The "-" option to
su should be setting up the correct environment,
but maybe nautilus is looking for something strange?

I've attached my hotplug script below.

Any light you could shed would be greatly
appreciated.

Ryan

------------------------------------------------------------
#!/bin/sh

cd /etc/hotplug
. hotplug.functions

# if present, images are automatically downloaded
DOWNLOAD=/home/ryan/images

# where jPhoto executable is installed
JPHOTO=/usr/local/bin/jphoto

# download images and launch viewer
if [ -d $DOWNLOAD ]; then
    cd $DOWNLOAD
    (echo '*** '$(date); $JPHOTO images --directory .; echo '') \
        >> images.$(date '+%Y-%m.%d')
    chown ryan:ryan *
    su - ryan -c "nautilus --display=:0.0 $DOWNLOAD > /home/ryan/nautilus.log 2>&1" &
fi







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]