[ILUGC] Re: How to restart a perl script if it is stopped?

  • From: Kamal Velan <sskamalavelan@xxxxxxxxx>
  • To: ilugc@xxxxxxxxxxxxx
  • Date: Mon, 25 Jul 2016 11:10:54 +0530

Hi,

If all you want to do is to keep it alive, the following
can help if you don't mind using npm.

https://www.npmjs.com/package/pm2

Thanks,
Kamal

On Mon, Jul 25, 2016 at 11:02 AM, Raman Pandarinathan <raamanp@xxxxxxxxx> wrote:

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/

_____________________________________
ILUGC List: //www.freelists.org/list/ilugc
ILUGC Web: http://ilugc.in/

Other related posts: