#! /bin/sh
#
# skeleton	Example file to build /etc/init.d scripts.
#
# Version:	@(#) /etc/init.d/skeleton 1.01 26-Oct-1993
#
# Author:	Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#

PIDFILE="diald.pid"
FIFO="diald.ctl"
ACCLOG="/var/log/diald"


  # See how we were called.
  case "$1" in
    start)
	cd /var/run
	rm $PIDFILE $FIFO 2>/dev/null
	mknod $FIFO p
#
# Uncomment the next lines & substitute the desired group for "dialout".
# This restricts access to the diald control channel to root and the members
# of the stated group.  For a single-user system, this is unimportant.
#
#	chown root.dialout $FIFO
#	chmod 660 $FIFO

	diald pidfile $PIDFILE fifo $FIFO accounting-log $ACCLOG \
	    connect "chat -v -f /etc/ppp/chat/das" \
	    local 192.168.42.3 remote 192.168.42.4 defaultroute
	;;
    stop)
	kill `cat /var/run/diald*.pid`
	;;
    down)
	kill -INT `cat /var/run/diald*.pid`
	;;
    up)
	ctldiald up
	;;
    *)
	# Oops someone made a typo.
	echo "Usage: /etc/init.d/diald {start|stop}"
	exit 1
  esac

  exit 0
