On Tue, Aug 01, 2006 at 08:53:15PM -0400, Jeff Quast wrote: > On 8/1/06, andrew fresh <[EMAIL PROTECTED]> wrote: > >I am in need the ability to run a script when a cd is inserted. I am > >not finding any way of getting notified when that happens, so I am > >asking here. If not, I can just loop cdio info and check for a disk. > > > >Is there something that will run a script when I insert a CD? > > > > I never checked for CD's, but hotplugd might say something when it is > inserted, I know it works for USB disks.
AFAIK hotplug only works for drives not disks. My testing just now shows that hotplugd does not see an event when I put in a CD > If it doesn't, and you write a patch to make it say something, it > might be appreciated. ya, that takes more C than I know at the moment, or that I have time to learn. > Of course, I would never do anything with it. But for headless > systems, it might be nice 'feature' for very certain situations. > > Never mentioned what you need it for.. What I am using it for is a CD burning machine. We are an ISP and have a CD that we give to our customers. It has a wizard that sets up their windows box to dial up and configures their email client. It also has some other software on it that we find handy if they don't have to download. Firefox, Thunderbird, AVG Antivirus, Windows service packs, stuff that is faster to drive and get a CD than it is to download over a modem. Most people don't need this, so it has not been cost effective to have them professionally pressed. Plus, doing it ourselves allows us to put new versions of the software on the disk more frequently. I have a script that uses the new cd burning capabilities of cdio to burn an iso onto a CD. For now I just have to have a loop that checks for a disk and burns it if one is inserted, what I would prefer is to just have the script run when a CD is put in. --- BEGIN burn_disk --- #!/bin/sh # You can run this like: # while [ true ]; do burn_disk ; sleep 3 ; done export DISC=cd0 export ISO=rraz.iso TRACK=`cdio -s info 2> /dev/null | cut -d " " -f 1` if [ X"$TRACK" = X"" ]; then echo No CD inserted, abort! exit 255 fi if [ "$TRACK" -gt 0 ]; then echo disk is not blank, abort! echo "o2EC" > /dev/speaker cdio eject exit 255 fi if [ "$TRACK" -eq 0 ]; then echo Disk is blank, we are go for burn! cdio tao $ISO if [ $? -eq 0 ]; then echo "o3l10c.cf.." > /dev/speaker cdio eject else echo Error with burn! echo "o2EC" > /dev/speaker cdio eject exit 255 fi fi --- END burn_disk --- l8rZ, -- andrew - ICQ# 253198 - JID: [EMAIL PROTECTED] BOFH excuse of the day: Robotic tape changer mistook operator's tie for a backup tape.