#!/bin/sh PROGNAME=`basename $0` ################################################################################ # # # START.DIP # # # # Connect to SLIP server, perform rerouting, mail checks and # # start the transfer of mail and news in both directions. Also # # watch the line for inactivity and disconnect if inactive for # # 3 minutes. # # # ################################################################################ # Without this line to redirect all output this script will not work under # cron exec > /dev/null 2>&1 # Also note that this script gets a bit confused if the cron interval is too # close. It shouldn't, but it does :-( # Check stat file and lock if necessary echo "$PROGNAME: INFO: checking request status" GETSLIPSTAT=/usr/local/bin/get_slip_stat [ `$GETSLIPSTAT` != P ] && exit 1 echo "$PROGNAME: INFO: locking with T $$" $GETSLIPSTAT -w T $$ # Option -nonews will suppress collection of news GETNEWS=true; [ "X$1" = "X-nonews" ] && GETNEWS="" echo "$PROGNAME: INFO: Calling SLIP server ... " /usr/local/src/dip/dip /homes/ops/lib/demon.dip [ $? -ne 0 ] && exit 1 # Change routing information echo "$PROGNAME: INFO: Changing routing tables ... " /etc/route del gate.demon.co.uk /etc/route add default gw gate.demon.co.uk DIPPID=`ps -axe | grep demon.dip | grep -v grep | awk '{ print $1 }'` echo "$PROGNAME: INFO: dip process started - $DIPPID" $GETSLIPSTAT -w C $DIPPID $GETSLIPSTAT -m | wall sleep 2 # Watch the line for time outs echo "$PROGNAME: INFO: Watching line activity ... " ( slip_idle -t 180 $GETSLIPSTAT -m | wall ) & # Deliver outgoing queued messages echo "$PROGNAME: INFO: Delivering outgoing mail ... " /usr/lib/sendmail -q # Now deal with outgoing news echo "$PROGNAME: INFO: Delivering outgoing news ... " /usr/local/lib/news/nntp/nntpsend betanews.demon.co.uk if [ "$GETNEWS" ]; then echo "$PROGNAME: INFO: Getting new news articles ... " /usr/local/lib/news/nntp/nntpxfer betanews.demon.co.uk fi echo "$PROGNAME: INFO: Process queued internet jobs ... " /usr/local/bin/njqrun internet # Just to emphsize that exit codes are important as this is called from # backoff. exit 0