LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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

Reply
 
LinkBack Search this Thread
Old 01-12-2005, 10:29 AM   #1
bobbens
Member
 
Registered: Sep 2004
Location: Barcelona
Distribution: Debian, FreeBSD, Gentoo
Posts: 586

Rep: Reputation: 30
make hotplug run a script on detect


How would i get around to making my external hdd to automatically mount when detected (connected via firewire). I have written the scripts already and they work perfectly, but how would i get around to making it automatic? Do i just have to add a line in some hotplug configuration file or something? Thanks.
 
Old 01-12-2005, 12:38 PM   #2
barryman_5000
Member
 
Registered: Jan 2005
Distribution: Gentoo/Vector/Debian
Posts: 95

Rep: Reputation: 15
The easiest method would be to edit your startup scripts for debian. I assume that hotplug is done in a high sequence number.

Simply make a file in the /etc/init.d directory containing something along the lines of:

mount /dev/sda1 /mnt/exthd

Set that file as executable:

chmod +x file

Then you run update-rc.d like so:

update-rc.d file defaults

That should do it for you. I wouldn't touch the hotplug script as it is rather annoying scripting. This way you can edit this script to test if mount returns an error or not and display a message accordingly. But that is complicated and gl if you want to do that.
 
Old 01-12-2005, 12:59 PM   #3
bobbens
Member
 
Registered: Sep 2004
Location: Barcelona
Distribution: Debian, FreeBSD, Gentoo
Posts: 586

Original Poster
Rep: Reputation: 30
Yeah i have the file as executable and the mount command with which uses quite a few options. I would rather make hotplug run the script, because i try to keep this external hard drive off as much as possible (so it can't get damaged) since it is my backup drive. I was thinking of making my scripts run when it detects the drive and depending whether it is sda or sdb it will mount it with my proper script, since i sometimes hook up a flashdisk or a mp3 player and it turns into sdb instead of sda. It probably uses the lines in lsusb, but i don't know where to make it so that in the case the usb line corresponds to the hdd it automatically mounts it using the proper letter sda or sdb, if the latter is too complicated i can just make it attempt to mount both so i'll have it mounted for sure. You seem to know how to do this with hotplug, where should i start looking? Thanks
 
Old 01-12-2005, 01:45 PM   #4
barryman_5000
Member
 
Registered: Jan 2005
Distribution: Gentoo/Vector/Debian
Posts: 95

Rep: Reputation: 15
well if it is a firewire device then perhaps you can edit the /etc/hotplug/ieee1394.agent script. Just match up the $VENDOR_ID's so that

if ["$VENDOR_ID" = "myvencor"]
do mount here
fi

just add that under the error handing Vendor_id line. This is a pretty big hack but it should work fine . . . . I haven't tried it, but good luck.

You can find your vendor's id via the /sys file system. Gl with that too.
 
Old 01-13-2005, 11:16 AM   #5
bobbens
Member
 
Registered: Sep 2004
Location: Barcelona
Distribution: Debian, FreeBSD, Gentoo
Posts: 586

Original Poster
Rep: Reputation: 30
Could "ST320082" be the vendor id? I looked around /sys and found the hdd, but instead of a vendor_id file i just saw a vendor file, which is the one above. Could this be the vendor id or do i have to keep on looking? The ieee1394 id is "0050770e00071002:0:0", it could also be it, not sure though. I think it would probably work better if i put it in the add) section, just gotta be sure of the vendor id. Which one do you think it is? Thanks.
 
Old 01-13-2005, 11:42 AM   #6
barryman_5000
Member
 
Registered: Jan 2005
Distribution: Gentoo/Vector/Debian
Posts: 95

Rep: Reputation: 15
most likely that first one.
 
  


Reply


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't make a script run hanasi Linux - Newbie 14 08-27-2005 03:14 PM
How do I make a script run at boot? ToothlessRebel Linux - Newbie 9 04-27-2005 01:46 AM
how do I make sure that the user that is going to run the script is a root user??? nikold01 Linux - General 3 09-10-2004 07:54 AM
Can Hotplug detect USB devices in a certain order? SAM_site Linux - General 0 07-10-2004 07:27 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM


All times are GMT -5. The time now is 10:24 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