[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pppd: how to die on connection lost



On Thu 17 May 2018 at 09:14:48 (+0200), Morel Bérenger wrote:
> Hello.
> 
> I am trying to make the pppd process to die if connection failed or is
> lost, so that I could restart the connection with a different script (I
> could tweak the chat script, but I'm still new to modem stuff and from
> the doc I can hardily find how to only specify the PIN code "once per
> hardware uptime" if you get what I mean).
> 
> I tried to read documentation from various sources, including debian's
> manpages, but failed to do that, so now I'm reading the code to see if
> it is possible to at least die if the chat script failed.
> 
> While reading the code ("apt-get sources ppp" gave me ppp-2-4-7, I'm
> on stretch), I've noticed a variable that might be used without being
> initialized. In fact, grep can not find any place where it's value is
> set:
> 
> ppp-2.4.7% grep -r callback_script -n
> debian/ppp.symbols:54: callback_script@Base 2.4.7-1+2~
> pppd/tty.c:132:char *callback_script;		/* script for
> doing callback */
> pppd/tty.c:562:	connector = doing_callback?
> callback_script: connect_script;
> 
> To me, it seems quite strange, and may be source of problems, but I
> guess there is some explanations?

I used to use ppp with callback (if I understand correctly what you're
doing) up until about 15 years ago. But ppp didn't dial or pick up the
calls: that was done by the mgetty package that managed the modem.

I would always be sitting in front on the PC that dialled the original
call and received the callback, so I was always aware if the connection
dropped for any reason.

But if I wanted to automate a reconnection after the line dropped,
I would probably be watching mgetty's logs and syslog with tail -F.
For example, at the calling-back end, mgetty dies and is respawned
when the call drops. I don't remember what's logged at my end because
I could see the modem lights and hear its clicks and characteristic beeps.

During the connection, pinging the other end is useful just to make
sure that data is passing.

Cheers,
David.


Reply to: