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

Re: perl daemon surviving changing ppp-links

by ybiC (Prior)
on Oct 20, 2005 at 03:45 UTC ( #501528=note: print w/ replies, xml ) Need Help??


in reply to perl daemon surviving changing ppp-links

This smells like it may be a routing persistance issue rather than an error in your code.   How do LWP::Simple or core Perl know internally that the active network interface and default gateway have changed mid-stream?   Not that they couldn't necessarily be made to refresh - I'm just asking, eh.

One possible (potentially hack-ish) workaround would be to automagically kill and re-launch your script using your Unix distribution's standard mechanisms.   With Debian Linux that would be scriptlets added to /etc/network/if-up.d/ and if-down.d/ directories.

  cheers,
  ybiC

  striving toward Perl Adept
  (it's pronounced "why-bick")


Comment on Re: perl daemon surviving changing ppp-links
Re^2: perl daemon surviving changing ppp-links
by Tanktalus (Canon) on Oct 20, 2005 at 04:12 UTC

    That may not be so hack-ish at all. In fact, it's a pretty good solution for other reasons, namely that the application won't be generating a bunch of errors that can be ignored. I hate what I call "erroneous errors" - errors that really should be dealt with by the application rather than the user. This is one of those cases - while ppp is down, you end up with a bunch of failures to download. All errors which you can ignore. Embedded in there may be other errors which are not ignorable, but they get lost in the clutter of ignorable errors, and you don't pay attention.

    By following your suggestion, the errors that are left are likely to be interesting/important errors that need to be addressed. Or there are no further errors, and you can more deservedly have a nice, warm, cozy feeling about how good of a job your script is doing in fetching whatever it is supposed to be fetching.

Re^2: perl daemon surviving changing ppp-links
by raphi72 (Initiate) on Oct 20, 2005 at 09:29 UTC
    Thank you for that suggestion.
    Using if-up if-down scripts is probably the best work-around.

    Still I'd like to know, whether it's possible to "refresh" the network parameters of a running perl script. Is it possible in C? The resolver library is part of libc, so how could I make my program reread /etc/resolv.conf?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-08-28 03:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (255 votes), past polls