2
# Copyright 2005-2006,2011 Sam Trenholme
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions
10
# 1. Redistributions of source code must retain the above copyright
11
# notice, this list of conditions and the following disclaimer.
12
# 2. Redistributions in binary form must reproduce the above copyright
13
# notice, this list of conditions and the following disclaimer in the
14
# documentation and/or other materials provided with the distribution.
16
# This software is provided 'as is' with no guarantees of correctness or
17
# fitness for purpose.
19
# This is a script which stops and starts the MaraDNS process
20
# The first line points to bash because I don't have a true Solaris /bin/sh
21
# to test this against.
23
# The following is a pointer to the MaraDNS program
24
if [ -x "/usr/sbin/Deadwood" ] ; then
25
DEADWOOD="/usr/sbin/Deadwood"
26
elif [ -x "/usr/local/sbin/Deadwood" ] ; then
27
DEADWOOD="/usr/local/sbin/Deadwood"
28
elif [ -x "/usr/local/bin/Deadwood" ] ; then
29
DEADWOOD="/usr/local/bin/Deadwood"
30
elif [ -x "/usr/bin/Deadwood" ] ; then
31
DEADWOOD="/usr/bin/Deadwood"
33
echo unable to find Deadwood
37
# The following is a pointer to the duende daemonizer
38
if [ -x "/usr/sbin/duende" ] ; then
39
DUENDE="/usr/sbin/duende"
40
elif [ -x "/usr/local/sbin/duende" ] ; then
41
DUENDE="/usr/local/sbin/duende"
42
elif [ -x "/usr/local/bin/duende" ] ; then
43
DUENDE="/usr/local/bin/duende"
44
elif [ -x "/usr/bin/duende" ] ; then
45
DUENDE="/usr/bin/duende"
47
echo unable to find duende
51
# The following is the directory we place MaraDNS log entries in
54
# Show usage information if this script is invoked with no arguments
55
if [ $# -lt 1 ] ; then
56
echo Usage: $0 \(start\|stop\|restart\)
60
# If invoked as stop or restart, kill *all* MaraDNS processes
61
if [ $1 = "stop" -o $1 = "restart" ] ; then
62
echo Sending all Deadwood processes the TERM signal
63
ps -e | awk '{print $1":"$NF}' | grep Deadwood | grep -v $$ | \
64
cut -f1 -d: | xargs kill > /dev/null 2>&1
65
echo waiting 5 seconds
67
echo Sending all Deadwood processes the KILL signal
68
ps -e | awk '{print $1":"$NF}' | grep Deadwood | grep -v $$ | \
69
cut -f1 -d: | xargs kill -9 > /dev/null 2>&1
70
echo MaraDNS should have been stopped
71
if [ $1 = "stop" ] ; then
76
# If invoked as start or restart, start the Deadwood processes
77
if [ $1 = "start" -o $1 = "restart" ] ; then
78
echo Starting Deadwood process