LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   udev rule for davfs2 (ubuntu, debian,..) (http://www.linuxquestions.org/questions/linux-general-1/udev-rule-for-davfs2-ubuntu-debian-940416/)

flux242 04-18-2012 05:37 AM

udev rule for davfs2 (ubuntu, debian,..)
 
Hi, I'm trying to figure out on how to start a script after a devfs is mounted. I need this to mount encfs on top of a mounted devfs directory automatically. I've found some examples on how to do it on boot using fstab but this is not what I need because I mount my devfs manually if needed. So I've tried the following udev rule
Code:

SUBSYSTEM=="fuse", RUN+="my_script.sh"
but it's never called.

Any hints on how to do this correctly? (Not necessary using udev)

catkin 04-18-2012 11:49 AM

udevd runs with a restricted PATH so best to give a full path to my_script.sh

When you write "but it's never called", do you mean the script begins by doing something simple to show it has run (such as touching a file)?

flux242 04-18-2012 12:15 PM

Quote:

Originally Posted by catkin (Post 4656263)
udevd runs with a restricted PATH so best to give a full path to my_script.sh

yes, there's a full path actually. Should the script belong to a udev group or something to be called by the udev?

Quote:

Originally Posted by catkin (Post 4656263)
When you write "but it's never called", do you mean the script begins by doing something simple to show it has run (such as touching a file)?

yes.

flux242 04-18-2012 12:17 PM

in the first posting I ment davfs and not devfs

catkin 04-18-2012 01:16 PM

Quote:

Originally Posted by flux242 (Post 4656280)
yes, there's a full path actually. Should the script belong to a udev group or something to be called by the udev?

Thanks for info.

udevd runs as root so no worries about who the script's owner is.

From what you have written it seems that the rule is not being matched.

When you do to "mount a davfs"?

flux242 04-19-2012 03:44 AM

Quote:

Originally Posted by catkin (Post 4656332)
When you do to "mount a davfs"?

you mean what not when, right?

I do 'mount /media/box'

catkin 04-19-2012 06:01 AM

Quote:

Originally Posted by flux242 (Post 4656936)
you mean what not when, right?

I do 'mount /media/box'

Right.

I see no reason why mounting a WebDAV file system (davfs) should trigger a udev event. udev is used when adding/removing devices and un/populates the /dev/ file system with device files, not when mounting file systems.

If you are going to mount it manually anyway, why not write a script which does the mount and then whatever else you want to do after that?

flux242 04-19-2012 12:34 PM

Quote:

Originally Posted by catkin (Post 4657172)
Right.

I see no reason why mounting a WebDAV file system (davfs) should trigger a udev event. udev is used when adding/removing devices and un/populates the /dev/ file system with device files, not when mounting file systems.

as I said:
Any hints on how to do this correctly? (Not necessary using udev).

Quote:

Originally Posted by catkin (Post 4657172)
If you are going to mount it manually anyway

I didn't say that. It could be triggered by another event. Like when I attach a usb stick it should trigger a chain of additional events that are independent from each other. And it's more convenient and flexible to define a set of rules rather that to write a script for every kind of mount points I have

catkin 04-19-2012 12:45 PM

Yes, you did write "Not necessary using udev" which is why I reasoned that a udev solution is AFAIK not possible and suggested a script.

Regards thinking that you mount the file system manually, I was misled by
Quote:

I've found some examples on how to do it on boot using fstab but this is not what I need because I mount my devfs manually if needed.
Which chain of events do you have in mind? Plugging in a USB device can be used to trigger a udev rule and that can run a command which can be a script. AFAIK mounting a file system manually does not trigger anything, hence my suggestion to script it so the script can do what you want.


All times are GMT -5. The time now is 09:28 PM.