[ILUGC] Re: How to restart a perl script if it is stopped?
- From: Raman Pandarinathan <raamanp@xxxxxxxxx>
- To: ilugc@xxxxxxxxxxxxx
- Date: Mon, 25 Jul 2016 11:02:46 +0530
On 7/25/16, Shrinivasan T <tshrinivasan@xxxxxxxxx> wrote:
I have a perl script in a desktop which is doing web scrawling
continuously.
when the internet connection goes down sometimes, the script tries for 5
min. Then it dies.
I want the script to run again once the internet is connected,
How can we achieve this?
Better way would be to check connectivity inside the script itself.
Use Net::Ping to test connectivity.
Something like
use Net::Ping;
my $p = Net::Ping->new;
while (1){
if ($p->ping('ipno you want check',1)){
run_your_function();
)
}
Raman.P
--
blog:
http://ramanchennai.wordpress.com/
_____________________________________
ILUGC List:
//www.freelists.org/list/ilugc
ILUGC Web:
http://ilugc.in/
Other related posts: