From owner-freebsd-questions Tue Jun 9 10:35:23 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA18946 for freebsd-questions-outgoing; Tue, 9 Jun 1998 10:35:23 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from Amnesiac.123.org (mcl@Amnesiac.mtl.pl [195.116.4.13]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA18898 for ; Tue, 9 Jun 1998 10:35:01 -0700 (PDT) (envelope-from mcl@Amnesiac.123.org) Received: from localhost (mcl@localhost) by Amnesiac.123.org (8.9.0/8.9.0.Beta5) with SMTP id TAA03168; Tue, 9 Jun 1998 19:34:29 +0200 (CEST) Date: Tue, 9 Jun 1998 19:34:29 +0200 (CEST) From: Michal Listos To: Capriotti cc: freebsd-questions@FreeBSD.ORG Subject: Re: Perl to sh script In-Reply-To: <3.0.32.19691231210000.00a4ae50@pop.mpc.com.br> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 " 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