Re: execute shell script on USB hotplug

From: Dances With Crows (danSPANceswitTRAPhcrows_at_gmail.com)
Date: 10/28/05

  • Next message: Eric: "hardware clock problems? (moved to alt.os.linux.suse)"
    Date: Fri, 28 Oct 2005 11:56:58 -0500
    
    

    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
    

  • Next message: Eric: "hardware clock problems? (moved to alt.os.linux.suse)"

    Relevant Pages