Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.