P
Paul Archer
I am in the process of developing a few scripts that:
1) pull images off a CF card on my laptop
2) move the images to a server
3) rename the images on the server according to the EXIF info
I figure that for 2 & 3, the easiest way to make sure they work is to have
them run in a cron job once a minute (or five). (Wake up, check to see if
there's any work, either do it or quit.)
The problem is that I need to make sure that if the script starts while
another copy of the script is running, it quits. I can work out how to
create lock files, stick in PIDs to make sure the script is really there,
etc. But it seems like someone must have tackled this problem already
(IIRC, I ran across a Perl module that back in my misspent youth).
Does anyone know of a gem (or just some canonical code) that handles this
easily?
Paul
PS I've also thought about using 'daemonize', but I'd still have to worry
about locking.
1) pull images off a CF card on my laptop
2) move the images to a server
3) rename the images on the server according to the EXIF info
I figure that for 2 & 3, the easiest way to make sure they work is to have
them run in a cron job once a minute (or five). (Wake up, check to see if
there's any work, either do it or quit.)
The problem is that I need to make sure that if the script starts while
another copy of the script is running, it quits. I can work out how to
create lock files, stick in PIDs to make sure the script is really there,
etc. But it seems like someone must have tackled this problem already
(IIRC, I ran across a Perl module that back in my misspent youth).
Does anyone know of a gem (or just some canonical code) that handles this
easily?
Paul
PS I've also thought about using 'daemonize', but I'd still have to worry
about locking.