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

Re: script to stay connected



On Wed, Jun 02, 2004 at 12:18:04AM +0300, David Baron wrote:
> Is there a little script that can be cron-d to check if the internet 
> connection (pptp -> ppp0) is up and if not, reconnect?

I have the following in /etc/ppp/ip-down.d/reconnect:

(
sleep 5
while ! ifconfig | grep ppp0 >/dev/null 2>&1; do
	if ! ps ax | grep '[0-9] /usr/sbin/pppd call dsl-provider' >/dev/null 2>&1; then
		pon dsl-provider;
	fi
	sleep 15
done
) &

"dsl-provider" should be replaced with the name of your connection (the
file in /etc/ppp/peers/). The script is executed as soon as the ppp
connection goes down and continually tries to reestablish it until it
succeeds.

Regards
Matthias



Reply to: