Re: how to detect inserted DVD media from bash or Perl?
Re: how to detect inserted DVD media from bash or Perl?
- Subject: Re: how to detect inserted DVD media from bash or Perl?
- From: Graham J Lee <email@hidden>
- Date: Wed, 2 May 2007 10:10:10 +0100
On 15 Apr 2007, at 19:32, Steve Hayman wrote:
On 14-Apr-07, at 4:24 PM, email@hidden wrote:
How do I detect the presence / insertion of a DVD, much like the
autorun mechanism on Linux? I want to automatically run certain
operations when the system detects that a DVD with certain files
has been inserted. Since this is a quick weekend project for a
friend, i'd like to be able to do it in Perl or bash if possible
(the "certain operations" I speak of are basically decompress the
files and copy them to a certain place). The DVD will likely be
created on a Linux or Windows box.
You might try using "wait4path /Volumes/MyDVD", which simply waits
for a specified path to show up; if the path isn't found, it sleeps
until the mount table is updated and then checks again. wait4path
exits when the path is finally there.
Interesting behaviour wait4path has though...it has a while(){}
instead of a do{}while(), so if the path already exists, it doesn't
return until an appropriate event occurs. Try "wait4path /" for
instance. I sent a patch in to bugreporter a good while ago, so
maybe 10.5 works differently...
Cheers,
Graham.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden