[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] Wonky ip-up (second try)
you want to put a line in your ip-up.local.....
if fetchmail is setup for root (ie fetchmailrc is in /etc/ or /root/) then
you can simply add
fetchmail
to ip-up.local... (if it doesn't exist, just create it)
not exactly inspiring scripting but it does work :-)
----- Original Message -----
From: "Richard Fletcher" <richard [at] icqme.freeserve.co.uk>
To: "Sheflug" <sheflug [at] vuw.ac.nz>
Sent: Saturday, March 10, 2001 3:30 PM
Subject: [Sheflug] Wonky ip-up (second try)
> Hello again. Now I have sorted getting fetchmail and sendmail to what I
want I
> would like to use them in my ip-up, not unreasonable. Yet nothing appears
to
> happen, I use the default ip-up from Suse6.3, and I do know that it is
being
> executed because /var/log/messages says it is. t is attatched for
convenience.
> If anyone could offer explanation I would be grateful.
>
> --------------------------------------
> Richard Fletcher
> Sheffield
>
>
> SuSe 6.3 Standard ip-up script Note it is linked so that it is also
ip-down.
>
>
> #!/bin/sh
>
> # (c) '97, S.u.S.E. GmbH, Fuerth, Germany
> # Klaus Franken <kfr [at] suse.de>
> # 25.02.98
> #
> # Remo Behn <sray [at] suse.de>
> # 18.07.98
>
> BASENAME=`basename $0`
> INTERFACE=$1
> DEVICE=$2
> SPEED=$3
> LOCALIP=$4
> REMOTEIP=$5
>
> if [ -z "$REMOTEIP" ]; then
> echo "Usage: $0 <INTERFACE> <DEVICE> <SPEED> <LOCALIP> <REMOTEIP>"
> exit 1
> fi
>
>
> case "$INTERFACE" in
> ippp*)
>
> . /etc/rc.config
>
> # find the device
> found=0
> for I in $NETCONFIG; do
> eval NETDEV=\$NETDEV$I
> if [ $NETDEV = $INTERFACE ]; then
> found=1
> break;
> fi
> done
> if [ $found -eq 0 ]; then
> echo "Device '$INTERFACE' not configured in '/etc/rc.config'"
> exit 1
> fi
>
> eval IFCONFIG=\$IFCONFIG$I
> DEST=`grep -v "^#" /etc/route.conf | grep "$INTERFACE\$" | awk '{
print $1}'`
> DEFAULT=`grep -v "^#" /etc/route.conf | grep default | awk '{ print
$2}'`
>
> #echo "ok, NETDEV:$NETDEV; IFCONFIG:$IFCONFIG."
> #echo " DEST: $DEST; DEFAULT: $DEFAULT"
>
> case "$BASENAME" in
> ip-up)
> # default deny
> #ipfwadm-wrapper -I -p deny
> #ipfwadm-wrapper -O -p deny
>
> # flush
> #ipfwadm-wrapper -I -f
> #ipfwadm-wrapper -O -f
>
> # accept dns
> #ipfwadm-wrapper -O -a accept -P udp -S 0/0 53 1024:65535 -D 0/0
53 -W $INTERFACE
> #ipfwadm-wrapper -I -a accept -P udp -D 0/0 53 1024:65535 -S 0/0
53 -W $INTERFACE
> #ipfwadm-wrapper -O -a accept -P tcp -S 0/0 53 1024:65535 -D 0/0
53 -W $INTERFACE
> #ipfwadm-wrapper -I -a accept -P tcp -D 0/0 53 1024:65535 -S 00/0
53 -k -W $INTERFACE
>
> # accept connect from client to internet
> #ipfwadm-wrapper -O -a accept -P tcp -S 0/0 1024:65535 -D 0/0 -W
$INTERFACE
> #ipfwadm-wrapper -I -a accept -P tcp -D 0/0 1024:65535 -S
0/0 -k -W $INTERFACE
>
> # deny, last match
> #ipfwadm-wrapper -I -a deny -P tcp -S 0/0 -D 0/0 -W $INTERFACE
> #ipfwadm-wrapper -I -a deny -P udp -S 0/0 -D 0/0 -W $INTERFACE
>
> # default accept
> #ipfwadm-wrapper -I -p accept
> #ipfwadm-wrapper -O -p accept
>
> /sbin/route add default gw $REMOTEIP dev $INTERFACE
>
> # maybe you want to start mail services:
> # set follow variables in /etc/rc.config
> # SENDMAIL_TYPE="yes"
> # SENDMAIL_SMARTHOST="<ISP-mailserver>"
> # SENDMAIL_ARGS="-bd -om"
> # SENDMAIL_EXPENSIVE="yes"
> # SENDMAIL_NOCANONIFY="yes"
> /usr/bin/fetchmail -a -v >>/var/log/fetchmail 2>&1 &
> /usr/sbin/sendmail -q -v &
>
>
>
> ;;
> ip-down)
> # restart interface
> /sbin/ifconfig $INTERFACE down
> # workaround due to kernel problem with 'kernd':
> sleep 1
> /sbin/ifconfig $INTERFACE $IFCONFIG
>
> /usr/local/bin/noffle --offline
> /usr/local/bin/wwwoffle -offline
>
> # flush, del all rules
> #ipfwadm-wrapper -I -f
> #ipfwadm-wrapper -O -f
>
> # set routes from /etc/route.conf
> test -z "$DEST" || /sbin/route add -host $DEST dev $INTERFACE
> test -z "$DEFAULT" || /sbin/route add default gw $DEFAULT
> ;;
> *)
> ;;
> esac
> ;;
>
>
> ppp*)
> # Analog-PPP, add commands as you need...
> case "$BASENAME" in
> ip-up)
> #
> # This code allows automatic configuration of your resolv.conf
> # for peer supplied DNS addresses when using the `usepeerdns'
> # option. Original resolv.conf is restored when ip-down is called
> # by pppd when the link goes down.
> #
> if [ -n "$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
> rm -f /etc/ppp/resolv.prev
> if [ -f /etc/resolv.conf ]; then
> cp -p /etc/resolv.conf /etc/ppp/resolv.prev
> grep domain /etc/ppp/resolv.prev > /etc/resolv.conf
> grep search /etc/ppp/resolv.prev >> /etc/resolv.conf
> cat /etc/ppp/resolv.conf /etc >> /etc/resolv.conf
> echo "Modified /etc/resolv.conf for DNS at $INTERFACE"
> else
> cp /etc/ppp/resolv.conf /etc
> chmod 644 /etc/resolv.conf
> echo "Installed /etc/resolv.conf for DNS at
$INTERFACE"
> fi
> if [ "$START_NSCD" = yes ]; then
> /sbin/init.d/nscd restart &
> fi
> fi
> test -x /etc/ppp/ip-up.local && /etc/ppp/ip-up.local $*
> ;;
> ip-down)
> #
> # This code restores the original resolv.conf saved when ip-up
> # was called by the pppd which uses the `usepeerdns' option and
> # resolv.conf was modified for the supplied dns server adresses.
> #
> if [ -n "$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
> if [ -f /etc/ppp/resolv.prev ]; then
> cp -fp /etc/ppp/resolv.prev /etc/resolv.conf
> echo "Restored original /etc/resolv.conf"
> else
> rm -f /etc/resolv.conf
> echo "Deinstalled /etc/resolv.conf"
> fi
> if [ "$START_NSCD" = yes ]; then
> /sbin/init.d/nscd restart &
> fi
> fi
> test -x /etc/ppp/ip-down.local && /etc/ppp/ip-down.local $*
> ;;
> *)
> ;;
> esac | logger -t $BASENAME
> ;;
> *)
> # dont know...
> ;;
> esac
>
> ---------------------------------------------------------------------
> Sheffield Linux User's Group - http://www.sheflug.co.uk
> To unsubscribe from this list send mail to
> - <sheflug-request [at] vuw.ac.nz> - with the word
> "unsubscribe" in the body of the message.
>
> GNU the choice of a complete generation.
>
>
>
---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word
"unsubscribe" in the body of the message.
GNU the choice of a complete generation.