#!/bin/sh
#
# diald   The on demand TCP/IP networking program
#
# chkconfig: - 57 5
# description: Diald is the smart demand-dial PPP/SLIP networking daemon. \
#      It selectively activates the SLIP/PPP link to the Internet when \
#       traffic is detected that is considered important.
# processname: diald
# config: /etc/diald.conf
# pidfile: /var/run/diald.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/diald ] || exit 0

[ -f /etc/diald.conf ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
	# Start daemons.
	echo -n "Starting diald: "
	daemon /usr/sbin/diald 
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/diald
	;;
  stop)
	# Stop daemons.
	echo -n "Shutting down diald: "
	killproc /usr/sbin/diald
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/diald
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  status)
	status diald
	RETVAL=$?
	;;
  *)
	echo "Usage: diald {start|stop|restart|status|reload}"
	exit 1
esac

exit $RETVAL
