Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Remote File Updating

by tmiklas (Hermit)
on Apr 25, 2002 at 08:53 UTC ( [id://161894]=note: print w/replies, xml ) Need Help??


in reply to Remote File Updating

In short... TMTOWTDI ;-)
If your program is for example waiting for some input (realtime log parsing?) then you can use it as a trigger (with counter or time interval check) that fetches with LWP required files (some data your script needs by itself) and rewrite the disk file. Then just gently close all open descriptors and try exec() or even exit() (if your script would start again automagically ;-p).
Another way - fork, sleep and send kill signal to the second process, it has to serve it with fetching with LWP, and so on... But remeber - $SIG{anything} routines should be as short as possible!
You can also write another program that only fetches those files and send SIGUSRn to your script (and then it should (re)load those files)...
I prefer to use 'at start' method - just chceck for a new version at startup. Just K.I.S.S. Simple solutions are the best solutions (IMHO) - even if it sometimes means to have a bunch of small scripts that work together ;-)

Greetz, Tom.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://161894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (None)
    As of 2024-04-25 00:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found