#!/bin/sh
SERVERNAME=$1
RCFILE=$2

# We must have an argument name
[ -z $SERVERNAME ] && exit 1

# Must be able to  read config file
[ -r "$RCFILE" ] || exit 1

# We must be able to read from the pipe
[ -p /var/run/maradns/$SERVERNAME.fifo ] || exit 1

# We should be the pid specified in the pid file
[ -f /var/run/maradns/$SERVERNAME.pid ] || exit 1
PID=`cat /var/run/maradns/$SERVERNAME.pid`
[ "$PID" = $$ ] || exit 1

exec /usr/sbin/maradns -f $RCFILE 2>&1 > /var/run/maradns/$SERVERNAME.fifo < /dev/null

