LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 04-18-2012, 04:37 AM   #1
flux242
LQ Newbie
 
Registered: Mar 2011
Posts: 15

Rep: Reputation: 0
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)

Last edited by flux242; 04-18-2012 at 04:39 AM.
 
Old 04-18-2012, 10:49 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,512
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
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)?
 
Old 04-18-2012, 11:15 AM   #3
flux242
LQ Newbie
 
Registered: Mar 2011
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by catkin View Post
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 View Post
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.
 
Old 04-18-2012, 11:17 AM   #4
flux242
LQ Newbie
 
Registered: Mar 2011
Posts: 15

Original Poster
Rep: Reputation: 0
in the first posting I ment davfs and not devfs
 
Old 04-18-2012, 12:16 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,512
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
Quote:
Originally Posted by flux242 View Post
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"?
 
Old 04-19-2012, 02:44 AM   #6
flux242
LQ Newbie
 
Registered: Mar 2011
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by catkin View Post
When you do to "mount a davfs"?
you mean what not when, right?

I do 'mount /media/box'
 
Old 04-19-2012, 05:01 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,512
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
Quote:
Originally Posted by flux242 View Post
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?
 
Old 04-19-2012, 11:34 AM   #8
flux242
LQ Newbie
 
Registered: Mar 2011
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by catkin View Post
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 View Post
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
 
Old 04-19-2012, 11:45 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,512
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
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.

Last edited by catkin; 04-19-2012 at 11:47 AM. Reason: run a script -> run a command which can be a script
 
  


Reply

Tags
encfs, fuse, udev


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting davfs2 with the Ubuntu 9.10 amirsd Linux - Software 1 01-20-2010 08:00 AM
udev rule: need help DPenguin Linux - Hardware 0 08-04-2008 07:29 PM
Udev Rule Help Please Toods Slackware 1 11-23-2007 08:55 AM
Setting up davfs2 with the Ubuntu package xjlittle LinuxAnswers Discussion 0 03-23-2007 02:25 PM
need help with udev rule hussam Linux - Software 2 12-05-2006 03:30 AM


All times are GMT -5. The time now is 03:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration