Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Mar 2003 12:17:06 -0600
From:      D J Hawkey Jr <hawkeyd@visi.com>
To:        Dan Langille <dan@langille.org>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: FreeBSD for Mom
Message-ID:  <20030312121706.A5989@sheol.localdomain>
In-Reply-To: <3E6F2EA7.8164.53EAFA7@localhost>; from dan@langille.org on Wed, Mar 12, 2003 at 12:57:11PM -0500
References:  <3E6F2EA7.8164.53EAFA7@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help

--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mar 12, at 12:57 PM, Dan Langille wrote:
> 
> My mom uses FreeBSD.  More precisely, she uses Pine to send/receive 
> email.  At present, she has a DSL connection.  She's soon to change 
> to a dial up account.
> 
> What I'm planning to do is provide her with a shell script which will 
> send/receive email for her.  She'll run it to check for mail and when 
> she's done composing her outgoing mail.
> 
> My initial untested idea is: 
> 
> - ppp --dial HerISP,
> - wait for the connection to come up

I can get you this far.

> - kill the connection

This one, too. See the attached script.

Note that I had to hack some files in /etc/ppp to get things to work right
(auto-dialup when anything WAN-related happens). If you want these too,
I can supply them, but I have to wonder if the list is the right forum?

I used kernel-mode PPP, BTW.

> Cheers
> -- 
> Dan Langille : http://www.langille.org/

Dave

-- 

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Description: EZ shell interface to pppctl
Content-Disposition: attachment; filename=pppc

#!/bin/sh
#
# EZ interface to pppctl. Supports connecting, disconnecting, setting the
# timeout value, showing the bundle, and testing the line (the last returns
# 0 if line up, the others return undefined).

# for cron
PATH=$PATH:/usr/sbin
# defined in /etc/ppp/ppp.conf
COMMCHNL=/var/run/ppp

TIMEOUT=180
NOISY=-v

test_up ()
{
	pppctl -v $COMMCHNL quit 2>/dev/null |grep ^PPP >/dev/null
	return $?
}

syntax ()
{
	echo "usage: "${0##*/}" -c|-d|-s|-v [-t timeout] [-q]"
	echo "       -c, -d, and -t always set a timeout (default="$TIMEOUT")"
	exit
}

if [ $# -eq 0 ]; then
	syntax
fi

while getopts "cdqst:v" OPT; do
	case $OPT in
		c) FLAG=c;;
		d) FLAG=d;;
		q) NOISY=;;
		s) FLAG=s;;
		t) TIME=$OPTARG;;
		v) FLAG=v;;
		*) syntax;;
	esac
done

if [ "$TIME" -o "$FLAG" -a "$FLAG" != "v" -a "$FLAG" != "s" ]; then
	if [ "$TIME" ]; then
		TIMEOUT=$TIME
	fi
	pppctl $NOISY $COMMCHNL set timeout $TIMEOUT
fi

case $FLAG in
	c) test_up;
	   if [ $? -eq 0 ]; then
	   	if [ "$NOISY" ]; then
	   		echo "Line is up"
	   	fi
	   	exit
	   fi;
	   exec pppctl $NOISY $COMMCHNL dial;;
	d) exec pppctl $NOISY $COMMCHNL close;;
	s) exec pppctl $NOISY $COMMCHNL show bundle;;
	v) test_up;
	   RETVAL=$?;
	   if [ "$NOISY" ]; then
	   	if [ $RETVAL -eq 0 ]; then
	   		echo "Line is up"
	   	else
	   		echo "Line is down"
	   	fi
	   fi;
	   exit $RETVAL;;
esac

--FCuugMFkClbJLl1L--

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?20030312121706.A5989>