Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 08e15fc958b2431d97480ba45764e38b > files > 1

maradns-1.3.07.09-5.fc15.i686.rpm

#!/bin/bash
# MaraDNS	This shell script takes care of starting and stopping MaraDNS
# chkconfig: - 55 45
# description: MaraDNS is secure Domain Name Server (DNS)
# probe: true

# Copyright 2005-2006 Sam Trenholme

# TERMS

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:

# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.

# This software is provided 'as is' with no guarantees of correctness or
# fitness for purpose.

# This is a script which stops and starts the MaraDNS process
# The first line points to bash because I don't have a true Solaris /bin/sh
# to test this against.

# The following is a pointer to the MaraDNS program
if [ -x "/usr/sbin/maradns" ] ; then
	MARADNS="/usr/sbin/maradns"
elif [ -x "/usr/sbin/maradns.authonly" ] ; then
	MARADNS="/usr/sbin/maradns.authonly"
elif [ -x "/usr/local/sbin/maradns" ] ; then
	MARADNS="/usr/local/sbin/maradns"
elif [ -x "/usr/local/sbin/maradns.authonly" ] ; then
	MARADNS="/usr/local/sbin/maradns.authonly"
else
	echo unable to find maradns
	exit 1
fi

# The following is a pointer to the duende daemonizer
if [ -x "/usr/sbin/duende" ] ; then
	DUENDE="/usr/sbin/duende"
elif [ -x "/usr/local/sbin/duende" ] ; then
	DUENDE="/usr/local/sbin/duende"
elif [ -x "/usr/local/bin/duende" ] ; then
	DUENDE="/usr/local/bin/duende"
elif [ -x "/usr/bin/duende" ] ; then
	DUENDE="/usr/bin/duende"
else
	echo unable to find duende
	exit 1
fi

# The following is the directory we place MaraDNS log entries in
LOGDIR="/var/log"

# The following is a list of all mararc files which we will load or
# unload;
# Simple case: Only one MaraDNS process, using the /etc/mararc file
MARARCS="/etc/mararc"
# Case two: Three MaraDNS processes, one using /etc/mararc.1, the second one
# using /etc/mararc.2, and the third one using /etc/mararc.3
# (this is not as essential as it was in the 1.0 days; MaraDNS can now bind
#  to multiple IPs)
#MARARCS="/etc/mararc.1 /etc/mararc.2 /etc/mararc.3"

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

RETVAL=0

start() {
	echo -n $"Starting all MaraDNS processes: "
	for rcfile in $MARARCS ; do
		echo -n $"$rcfile "
		# Duende syslogs MaraDNS' output messages and daemonizes MaraDNS
		daemon $DUENDE $MARADNS -f $rcfile || RETVAL=$?
	done
	echo
	[ $RETVAL -eq 0 ] && echo `pidof maradns` > /var/run/maradns.pid && touch /var/lock/subsys/maradns
}

stop() {
	echo -n $"Stopping MaraDNS: "
	killproc maradns
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/maradns
}

restart() {
	stop
	start
}

case "$1" in
  start)
	start
	;;
  stop) 
	stop
	;;
  restart|reload)
	restart
	;;
  condrestart)
	[ -f /var/lock/subsys/maradns ] && restart || :
	;;
  status)
	status maradns
	RETVAL=$?
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
	exit 1
esac

exit $RETVAL