cooper Posted February 10, 2007 Share Posted February 10, 2007 A friend of mine is converting an old laptop to a pictureframe PC. So far he's gotten Damn Small Linux installed on it and with a little help from yours truly it now boots straight into a user account, starts X and then kicks in the randomized image slideshow. What he now wants to do is that when he inserts a USB stick into the machine, that the machine will automatically copy over all images from the stick onto the local filesystem, restart the image viewer so it can become aware of the newly added files, and possibly make the internal speaker beep once so he'll know the process is complete. Now, I can easily script the doing of those tasks (the beep might be something to investigate, but an echo of ASCII 7 is prolly enough), but the tricky part is getting the script the actually run when the USB drive is inserted. To make matters slightly worse, the Linux installation we painfully managed to install on the machine uses a Linux 2.4 kernel without udev or simliar hotplug stuff support best I can tell. Any suggestions? Quote Link to comment Share on other sites More sharing options...
Sparda Posted February 10, 2007 Share Posted February 10, 2007 You could have a cron job that looks for new entries in /dev every minuet or so, then do all the mounting and copying stuff when it finds a new entire (your script will probably have to assume the usb device inserted is at /dev/sda1 and that it's vfat). The only down said to this is that you will have to have the USB device plugged in for upto a minuet for any thing to happen. Quote Link to comment Share on other sites More sharing options...
SomeoneE1se Posted February 10, 2007 Share Posted February 10, 2007 Could you create a howto and then post up the scripts on the wiki I'd love to take a look at how this is done.(once it's done) Quote Link to comment Share on other sites More sharing options...
Sparda Posted February 11, 2007 Share Posted February 11, 2007 No real need to do that, it's all over google: http://www.scrounge.org/linux/cron.html http://www.adminschoice.com/docs/crontab.htm to make the script run once ever minuet you would set the cron file up like so: 0-59 * * * * root perl /root/mycopyingsctipt.pl * * * * * should also work as you are telling it to run every minuet of every hour of every day of the month of every month of every day of the week, but 0-59 * * * * gives more clarity. (that was a nasty sentence to write lol, now time for some Zelda :D) Quote Link to comment Share on other sites More sharing options...
cooper Posted February 11, 2007 Author Share Posted February 11, 2007 As there is no udev, no new entries will appear on insertion of the stick. If the thing had udev, we could've used the discovery scripting stuff to start off the script we want to run. We could just automatically mount /dev/sda1 every minute from cron, but I don't really like that to be honest. Additionally, some locking logic needs to be put in place in case the copying over of the images takes more than 1 minute to complete. Nobody knows of a more targeted insertion detection mechanism? Quote Link to comment Share on other sites More sharing options...
nickisgod1 Posted February 13, 2007 Share Posted February 13, 2007 been forever since i used a system with no udev, maybe dmesg would pic up the usb insertion and you could check that? any reason now that you have a bootable system, you cant compile a 2.6 kernel and udev for the system? unless its ancient it should work Quote Link to comment Share on other sites More sharing options...
cooper Posted February 13, 2007 Author Share Posted February 13, 2007 That's the thing. It _is_ ancient. Not so ancient that Linux 2.6 couldn't run on it, but this particular problem isn't serious enough to warrant a kernel replacement. So far his view is that it'll either get to work with 2.4, or he'll just live without the automagic copying over of the data. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.