Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Remote File Updating

by tmiklas (Hermit)
on Apr 25, 2002 at 08:53 UTC ( #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? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2022-05-18 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?