From your last description it sounds like you run your stuff from a terminal window. It should also be possible to run it as a service/in the background so it is not dependant on somebody/something terminating your terminal window. This doesn't exclude something/somebody terminating your script itself ofcourse.
Also, for network performance/failure type of measurements there are some excellent pieces of software available (written in perl):
In reply to Re: Ping log terminates unexpectedly
by eXile
in thread Ping log terminates unexpectedly
by Scrat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |