[H-GEN] Automatic execution of a script/program upon receipt of a file?

Jason Parker-Burlingham jasonp at panix.com
Thu Jul 13 01:11:02 EDT 2006


On 7/12/06, Bowen Denning <codemech at gmx.net> wrote:

> >> 2) any easy way to implement it?
> Yes
>
> Have a look at the "Some Simple Automation" section in the below link.
> http://www.mcsr.olemiss.edu/parallelogram/01_01/samba2.html

I think this is the wrong solution to the problem.  It's not
altogether clear to me from reading that article that the command will
be run in the time frame that a user might expect.

The summary for postexec from the article you point to says the
command runs when the user disconnects from the share.  That doesn't
necessarily mean that the file was finished being written any time
recently---if the user opens a file browser window, drops the file
into place, and then leaves the window open, how long will the
connection to the share be kept open by the client?

I think it's much better to check the directory for new files
periodically, as has been suggested previously.  You'll want to not
check obsessively, mostly because there's no reason to do so, but
often enough to save the user some time.  A good metric might be to
check at intervals of about 1/2 to 1/3 as long as it takes to
transcode a typical video file.  That way, users may not notice the
overhead, but you won't try to operate on a file that isn't finished
being written to, or that a user (probably) isn't about to yank out
from under you.

Whichever route you go, I think you'll want to run some sanity checks
on your input:  is it too big?  Will it take too long to convert?  Is
it actually a video file, or something else?  (Ten bucks says that
someday, someone will write a Windows "shortcut" into the share.)

If I were implementing this I would simply say that processing is
batched overnight, not on-demand, and spend more time on the problem
of making sure that the transcoding job either completes, or fails in
an acceptable manner.

jason




More information about the General mailing list