#!/bin/sh
#
# Startup script for the DNS caching server
#
# chkconfig:	2345 81 45
# description:	Anubis is an outgoing mail processor, and the SMTP tunnel.
# processname:	anubis
# config:	/etc/anubisrc

# Set some frequently user variables
SERVICE=anubis
LOCKFILE=/var/lock/subsys/$SERVICE
MSG="anubis remailer"
PROG=$SERVICE

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

# Get network config
. /etc/sysconfig/network

# Check that networking is up
if is_no "$NETWORKING"; then
	msg_Network_Down $MSG
	exit 1
fi

# Get service config
[ -f "/etc/sysconfig/$SERVICE" ] && . "/etc/sysconfig/$SERVICE"

# See how we were called.
case "$1" in
  start)
  	if [ ! -f "$LOCKFILE" ]; then
		msg_starting "$MSG"
        	daemon $PROG
		RETVAL=$?
        	[ $RETVAL -eq 0 ] && touch $LOCKFILE
	else
		msg_Already_Running $MSG
		exit 1
	fi
        ;;
  stop)
  	if [ -f "$LOCKFILE" ]; then
		msg_stopping "$MSG"
        	killproc $PROG
		rm -f $LOCKFILE  >/dev/null 2>&1
	else
		msg_Not_Running "$MSG"
		exit 1
        fi
        ;;
  status)
	status $PROG
	exit $?
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
        msg_Usage "$0 {start|stop|restart|reload|status}"
        exit 1
esac

exit $RETVAL

