Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jun 1998 19:34:29 +0200 (CEST)
From:      Michal Listos <mcl@Amnesiac.123.org>
To:        Capriotti <capriotti@geocities.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Perl to sh script
Message-ID:  <Pine.BSF.3.96.980609190300.29455G-100000@Amnesiac.123.org>
In-Reply-To: <3.0.32.19691231210000.00a4ae50@pop.mpc.com.br>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 9 Jun 1998, Capriotti wrote:

> Script name: internet
> 
> Accepted parameters: ON or OFF
> 
> if call is internet on or internet ON :
> 
>     check if ppp -alias -auto isp   is running
>     if not, call ppp -alias -auto isp
> 
> if call is internet off or internet OFF: 
>     check if ppp -alias -auto ips is running
>     get PID
>     kill process
>     exit
It's untested (I don't use ppp), but should work. 
If your ppp isn't running on tun0 device, you may need to modify that script.

---start
#!/bin/sh
PATH=/bin:/usr/sbin
if [ x$1 = xON ]
then
 kill -0 `/var/run/tun0.pid`
 if [ $? -ne 0 ]
 then
  ppp -alias -auto isp
 fi
elif [ x$1 = xOFF ]
then
 kill `cat /var/run/tun0.pid`
else
 echo "Usage: $0 <ON|OFF>"
fi
---end
						Michal

* God used fork() to create Eve.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980609190300.29455G-100000>