LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   hotplug action (https://www.linuxquestions.org/questions/linux-software-2/hotplug-action-534657/)

baloon 03-05-2007 01:59 AM

hotplug action
 
hello

I need to create a script which will start nautilus when a usb pen drive is inserted into the slot. I created a script in /etc/hotplug/usb/<usb-storage> as below.

#!/bin/sh

DISPLAY=localhost:0.0
echo "Storage is inserted " >/tmp/hahaha


case $ACTION in
add)
echo "Action is to add storage device" >>/tmp/hahaha
echo "Display = $DISPLAY" >>/tmp/hahaha
nautilus /media/usbdisk 2>>/tmp/hahaha
;;
remove)
echo "Action is to remove storage devide" >>/tmp/hahaha
;;
*)
echo "Default action = $ACTION"
;;

esac

This script doesn't open nautilus program. The following is the contents of /tmp/hahaha.

Storage is inserted
Action is to add storage device
Display = localhost:0.0
start nautilus

(nautilus:5820): Gtk-WARNING **: cannot open display:


how do I resolve this ?

-B

joel2001k 03-07-2007 12:09 PM

I think use the --display argument eg. 'nautilus --display :0.0'

synx 03-16-2007 04:55 PM

It might be an xauth problem. Does the user running the hotplug script have permission to use the X server? Do hotplug scripts just run as root? I guess in that case you'd need to xauth extract, then xauth merge while logged on as root.


All times are GMT -5. The time now is 01:46 PM.