in reply to compound perl question

It would be pretty easy, but I think it makes mose sense to just run pppd from loop inside a perl program:

	while ('true') {
	  system("pppd ...");
	  print STDERR "pppd exited; restarting...\n";
	}

That's what I do on my system, except my script has some logging and it has some safety features so that it doesn't spin out of control if I shut off the modem or something like that.

Replies are listed 'Best First'.
RE: RE: compound perl question
by Anonymous Monk on Mar 12, 2000 at 05:40 UTC
    In my infinite newbie-ness, it appears that this will just echo back that it has exited and will restart ...but doesn't actually *do* that.

    Am I applying the wrong tools (perl) for this job?

    thx,
    nascent

      You might be thinking of the exec command. Take a look at system. It actually forks off the system call, and then the parent waits for the child to exit before proceeding. When pppd exits, the parent process will print the error message, hit the end of the loop, and repeat.

      With your original question, I would do something like: my $ifconfig_data = `/sbin/ifconfig ppp0`; and then use a regexp to look for a valid IP address or whatever you like.