http://qs1969.pair.com?node_id=284531


in reply to triggering a program in web server

Hi!

You can launch the upload-to-B program directly from the script which, on A, receives the file uploaded via web. This might however slow the response to the user down, depending on how fast is the connection between A and B.

Another option is to have upload-to-B program run as a daemon, which every now and then (how much often you wish) checks for new uploaded files and sends them to B.

Hope this helps!

Michele.

Replies are listed 'Best First'.
Re: Re: triggering a program in web server
by tja_ariani (Acolyte) on Aug 18, 2003 at 10:41 UTC
    Hi,

    you're rite, I was thinkin to have the program run as a daemon, but I do not know how to do the scheduling part.
    Is there any simple program or piece of code as an example to show how to do this ?

    I was thinkin using infinite loop in the program to check, but will it slow down the server ?
    Or is there any command to 'sleep' the program periodically ?

    Thanks

      A possible approach is: every time a file is uploaded you put a link to that file in a special directory; then every n seconds (via cron or using sleep) you check the directory, move new files and delete links.

      HTH, Valerio

      I was thinkin to have the program run as a daemon, but I do not know how to do the scheduling part.

      Take a look at Net::Daemon . But I can't see the advantage of running this as a daemon is (the small performance gain of not loading Perl?).
      --
      bm