Hi, I'm running an Ubuntu server and I'd like to have a program launched automatically each time my network connection is resumed after a loss of ISP connection. Is there any program or script that can give me what I want?

..The reason for this is that I'm doing a large upload that takes days/weeks at the moment and my ISP connection is increadibly unstable atm, breaking my FTP connetion all the time. If I could automatically relaunch ncftp & resume each time the connection comes back I could solve this problem.

I'm not exactly sure on how the network connection loss / reconnect is best detected in the first place.. It's not like I'm losing my IP address to the router. Must I script/program some DNS server pinging or something?