execute shell script on USB hotplug

I would like to execute a shell script when a user plugs in a USB
storage device so I can automate the process of adding and removing
MP3s and other files.

The machine this is running on will be used only for adding and
removing MP3 files from USB storage, and will have a web-based GUI, if
that makes a difference.  (This will be a publically accessable kiosk)

I was hoping to find some more details on using the hotplug system
and/or udev in the hardware section.  Any ideas?

0
10/28/2005 1:59:21 PM
comp.os.linux.hardware 9596 articles. 0 followers. Post Follow

1 Replies
298 Views

Similar Articles

[PageSpeed] 23
On 28 Oct 2005 06:59:21 -0700, oneseventeen@gmail.com staggered into the
Black Sun and said:
> I would like to execute a shell script when a user plugs in a USB
> storage device so I can automate the process of adding and removing
> MP3s and other files.

This sounds like a recipe for disaster to me.  What if the user's device
has a weird directory structure, a weird filesystem, or only 500K free?
Most automated processes like the ones you describe must make a large
number of assumptions, and if their assumptions aren't correct, they
tend to fail in interesting and stupid ways.  (Been There, Done That,
Got The T-Shirt.)

> I was hoping to find some more details on using the hotplug system

/etc/hotplug/ should contain a bunch of files that have a bunch of
comments in them.  On my Gentoo system, /etc/hotplug/usb/usbcam is a
shell script that executes when a USB camera that matches a large list of
device IDs is plugged in.  This script just does a chmod/chown to the
camera's device node so the currently-logged-in user can do stuff, but
it could be rearranged to do other things.  "man 8 hotplug" may also
provide info on the guts of the hotplug system.  HTH,

-- 
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /    mail: TRAP + SPAN don't belong
http://www.brainbench.com     /    "He is a rhythmic movement of the
-----------------------------/      penguins, is Tux." --MegaHAL
0
10/28/2005 4:56:58 PM
Reply:
Similar Artilces:

shell scripts
where do i go to start to learn how to write shell scripts for mac os X?? i understand the basics that you use small programs to do certain things.. such as curl to ftp etc, and i have some prior knowlage of scripting in the form of javascrip / lingo / action script and a small bit of python.. cheers Greg Brant On 4 Nov 2003, Greg Brant wrote: > where do i go to start to learn how to write shell scripts for mac os > X?? Find documentation on your shell of choice (bash, tcsh, zsh ...) There are plenty of tutorials on all of those shells. Fred > > i understand the basics th...

Pause execution?
Is there someway to pause the execution of a program? I have a large while loop and before it gets started I would like to pause the program so I can see the output before it gets overwritten by the loop. desktop wrote: > Is there someway to pause the execution of a program? I have a large > while loop and before it gets started I would like to pause the > program so I can see the output before it gets overwritten by the > loop. Have an input statement there, something like { std::string blah; std::cout << "pausing, press enter..." << std::flush...

execute vi when a certain file is in a certain directory
Hello I have a VI which read and converts a bmp into a&nbsp; 2D array. Now a want that the&nbsp;VI does this automaticely when&nbsp;&nbsp;a new bmp is inserted by another external application in this directory. I don't know how to do this. Thanks for your help &nbsp; Simon 2d Array ausBitmap.vi: http://forums.ni.com/attachments/ni/170/198054/1/2d Array ausBitmap.vi There is indeed a .NET assembly which can be set to watch a directory for new files to appear. You can register for a .NET callback event if a file is created, renamed, deleted, etc. You can also explicitl...

Executing the executable
Using Microsft Visual Studio C++ 6.0, I have compiled my code and I need to execute this executable by specifying my input file and my output file, eg. ./DMDC2 input > output. Input file is a separate normal file and not a visual C++ file. "Vikram" <vikram3@hotmail.com> wrote in message news:d57dd844.0407230046.67352135@posting.google.com... > Using Microsft Visual Studio C++ 6.0, I have compiled my code and I > need to execute this executable by specifying my input file and my > output file, eg. ./DMDC2 input > output. Input file is a separate > normal file...

execution problem
A mysterious problem happens, has anyone experienced this and what is the solution. I have a notebook with cell expressions, when I hit shift-Enter, it doesn't execute, but if I add a space then shift-enter, then it will execute. What is the problem? ...

US-NY-Rochester: Tester, Silk, Perl, Oracle, Unix scripting, SQL, Toad, Training (45338057601)
US-NY-Rochester: Tester, Silk, Perl, Oracle, Unix scripting, SQL, Toad, Training (45338057601) ============================================================================================== Position: Tester Reference: SMC01871 Location: Rochester NY Duration: 6M Skills: Testing using Silk, Perl,oracle, Unix scripting, SQL, Toad Web based testing exp Advanced skills with web-appls capture/playback automation using Silk Understand development strategies Excellent Tech Writing skills ...

US-MD-Rockville: Developer, ProC (2+yrs), Oracle (2+yrs), Scripting, UNIX; 7M (45338457609)
US-MD-Rockville: Developer, ProC (2+yrs), Oracle (2+yrs), Scripting, UNIX; 7M (45338457609) =========================================================================================== Position: Developer Reference: SMC01892 Location: Rockville MD Duration: 7M Skills: Strong Unix bckgd Shell scripting Unix commands Strong Pro*C Oracle 2-3 yrs (9i experience preferred) Maestro (or some other scheduling tool) Visual Basic skills Strong problem-solving skills w/ d...

using PROMPT_COMMAND to set shell window title
I want to use PROMPT_COMMAND to set `history -a'.. for an experiment. (PROMPT_COMMAND="history -a" But I find these settings (intended to create a title for terminal windows) in ~/.bashrc by default: case $TERM in xterm*|rxvt|Eterm|eterm) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' ;; screen) PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"' ;; esac Of course I can remove them but I like the effect of those settings so wondering if there is a differen...

forte executes, but jcreator wont
I'm just starting a java programming course. I'm trying to write this code in Jcreator, but I get a NoclassDefFoundError when executing this simple code. It compiles ok in Jcreator and Forte, but will only run in Forte. /* Program Name JavaRocks.java * Author Me * Creation date 1/21/04 */ public class JavaRocks { public static void main (String[] args) { System.out.println ("Java Rocks"); } } In article <c00cc162.0401242041.2d1f6a89@posting.google.com>, woodrowsj3 @yahoo.com enlightened us with... > I'm just starting a java programming cou...

How should I store one bash script inside of another?
I've come across a problem that's making my head hurt.... A couple of years ago, I wrote two scripts that I used to copy my public keys in my local $HOME/.ssh to the authorized_hosts/ authorized_hosts2 files on any remote machine (which would allow me to login to the remote machine without needing a password anymore). The second script ran on the remote host and actually imported the keys into the authorized_hosts* files. The first script used scp to copy the second script and public keys over and then used a ssh call to run the script on the remote host. Because the first script use...

FAQ 9.1 What is the correct form of response from a CGI script? #8
This is an excerpt from the latest version perlfaq9.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 9.1: What is the correct form of response from a CGI script? (Alan Flavell <flavell+www@a5.ph.gla.ac.uk> answers...) The Common Gateway Interface (CGI) specifies a software interface between a program (&q...

Encoding for Devanagari Script.
Hello All, I wanted to know what encoding should I use to open the files with Devanagari characters. I was thinking of UTF-8 but was not sure, any leads on this? Anyone used it earlier? Thanks in Advance. Regards, Atul. Atul. skrev: > I wanted to know what encoding should I use to open the files with > Devanagari characters. I was thinking of UTF-8 but was not sure, any > leads on this? Anyone used it earlier? Are we talking about existing files? If you don't know what encoding the files use, you could always try using the UTF-8 codec; it's very likely to complain if ...

"><script>alert('ss')</script>
"><script>alert('ss')</script> On 8/24/2011 4:37 PM, silic0n wrote: > "><script>alert('ss')</script> That was most informative. Now learn how to use a computer before using it, please. Thanks. Erwin Moller -- "That which can be asserted without evidence, can be dismissed without evidence." -- Christopher Hitchens ...

Detect-and-run a method in a Script Host using Java and FESI
Hi, Everybody: I have a script host that implemented in Java and using FESI to run JavaScript. The JavaScript files are separated into different files and putting together at run or load time. Every time I have to manually to make sure that a function referenced in one file is defined in another so my host won't crash due to exception. I have been trying to put in a detect-and-execute logic in my code for some time but with no real success. This mainly due to FESI limitation. I believe only JavaScript 1.1 is supported. I have tried eval with try-catch but FESI won't allow the key word...

How to deploy a Ruby executable?
I have looked everywhere and can't find answers to the following questions: 1) Can I create a compiled executable with Ruby as I can with other languages? 2) How does one deploy a Ruby application? If someone could please point me to where in any documentation this is covered, I would be most grateful. -- Posted via http://www.ruby-forum.com/. Rolf Marsh wrote: > I have looked everywhere and can't find answers to the following > questions: > > 1) Can I create a compiled executable with Ruby as I can with other > languages? > 2) How does one deploy a Ruby ap...

Cable Executives See Growth, Consolidation in 2004
By Michael Learmonth NEW YORK, Dec 12 (Reuters) - After years of costly network upgrades, the nation's largest cable operators said this week they're ready to rake in the cash in 2004 and are looking for mergers. "They've made a lot of progress deleveraging debt and building up free cash flow," said UBS media analyst Aryeh Bourkoff. "In fact these companies could be underleveraged in 2004, leading the way for further consolidation." Share prices across the cable industry rose this week after the industry shared optimistic outlooks with analysts at...

Mutt-NG: script for anyone wanting to build RPM's
If anyone wants to take the Mutt-NG (http://mutt-ng.berlios.de) daily builds for a spin and would like them packaged as an RPM then this script is for you :-) http://iainlea.dyndns.org/software/muttng/muttng-rpmbuild.sh Enjoy Iain -- +49-172-8196039 Skype VoIP: iain.lea "You can get much further with a kind word and a gun, than with a kind word alone" -- Al Capone ...

shell script to FTP a file?
Hi, I am running Fedora Core 5 Linux and I am looking for a shell script to upload a file to a remote FTP server. I know the host, username, password and starting directory. Can someone provide me with a series of commands or guidance to write a shell script to FTP the file? Thanks, - Dave On 2006-11-14, laredotornado@zipmail.com wrote: > Hi, > > I am running Fedora Core 5 Linux and I am looking for a shell script to > upload a file to a remote FTP server. I know the host, username, > password and starting directory. Can someone provide me with a series > of commands ...

Re: multiple instances of executable
I know this thread is rather old but still... I have the same problem. Sometimes it is possible to start a new instance of the same app, sometimes not. For my application it is vital that only one instance is running. I tried to understand your SetNamedMutex-vi with no luck. Can I use it to find already running apps? Here is what I have tried: I started "myapp.exe". The I run "SetNamedMutex.vi" with "myapp.exe" in the name-field. But no matter if myapp.exe is running or not, SetNamedMutex always returns 0 (Existing=false) Could someone help me here? LV7.0 Win2...

fieldpoint drop down menu executable
Hi, &nbsp; I am working with FieldPoint. Everything work fine, until I built the .exe file. When I click on the FieldPoint IO Point I see the browse ... But when I select it there is a pop up window appears for 1/2 sec then it disappears. It means the drop down menu does not work. I cannot select the channel. Can anyone tell me how to fix this? Thank This is the project, I use only one control which is the FP IO point. I can not open to select it. Please check it for me. Highly appreciate for your time, Thang Nguyen TestFPIOPoint.zip: http://forums.ni.com/attachments/ni/170/248176/1/Tes...

Looking for shell download manager
Hi there. Is there any true download manager for the shell? I don't mean simple downloaders like curl or wget but the kind of program like Kget or the ones integrated in Firefox or Opera, probably ncurse based. Does such a program exist? -Erik -- hackerkey://v4sw5hw2ln3pr5ck0ma2u7LwXm4l7Gi2e2t4b7Ken4/7a16s0r1p-5.62/-6.56g5OR In <ga7qr5-9j4.ln1@a-b.bplaced.net>, Erik Hahn <erik_hahn@replyto.invalid> mentions: >Hi there. Is there any true download manager for the shell? I don't mean >simple downloaders like curl or wget but the kind of program like Kget or >th...

No Remote access to Executable #2
Hi, &nbsp;&nbsp;&nbsp; &nbsp; I want to run&nbsp;.exe&nbsp;on remote PC. I created an .exe from VI. Then I try to run .exe file on remote PC. See the attached error. &nbsp; But able to run VI rather than .exe. &nbsp; Please let me know, how to over come this. &nbsp; VI directory :D:\jey\Test.vi .exe&nbsp;directory :D:\jey\Test\Test.exe &nbsp; On Client PC, What "VI Name" I supposed to call. Test.vi or Test.exe &nbsp; &nbsp; Thanks for help Jey &nbsp; RemoteAssess_Error.doc: http://forums.ni.com/attachments/ni/170/215380/1/Rem...

New price list for mp3 player, digital camera, cd/vcd/mp3 player and USB flash drive! #3
Dear valued customer, We are a professional manufacturer of mp3 player, cd/vcd/mp3 player, digital camera and USB flash drive in Shenzhen, China. Please see the price of some products: mp3 player with digital recorder and USB flash drive 64M 39USD 128M 52USD cd/vcd/mp3 player (3 function in 1) 21.5USD digital camera 300K pixels 15.5USD 1.3M pixels 24USD PC camera 13USD 350K pixel USB flash drive 64M 17.9USD 128M 29.9USD 256M 54.9USD If you have interest, please contact us and we will give you the detailed catalogue and price list. We always try our...

Error 8 occurred when building an executable due to file permission error?
I received this error on executable builds from two different .vis.&nbsp; Other .vis in the project build without incident and the message below doesn't seem to indicate the file that is causing the problem, unless it is the SPT-errors.txt file listed at the end of the error message. &nbsp; Visit the Request Support page at ni.com/ask to learn more about resolving this problem. Use the following information as a reference: Error 8 occurred at Copy in AB_Engine_Copy_Error_Files.vi-&gt;AB_Application.lvclass:Copy_Error_Files.vi-&gt;AB_Application.lvclass:Copy_Files.vi-&gt...

shell script help needed
I'm using ksh as my shell and I need to set my emulation based on wether I'm logged in via tty or a pts. I know it's possible to type "tty" at the command line and get "/dev/tty/whatever" or "/dev/pts/whatever". Can I write a little if statement and insert it into my .profile to test for this and set the emulation appropriately? Thanks for any help you can provide. Dave this doesn't work... #! /bin/ksh -p if [tty | grep -c tty eq 1];then echo "it's a tty" elif [tty | grep -c tty eq 0];then echo echo "it's a pty"...