Last active
December 22, 2015 02:49
-
-
Save davidpelaez/6406122 to your computer and use it in GitHub Desktop.
Original maradns init script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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" | |
| # Show usage information if this script is invoked with no arguments | |
| if [ $# -lt 1 ] ; then | |
| echo Usage: $0 \(start\|stop\|restart\) | |
| exit 1 | |
| fi | |
| # If invoked as stop or restart, kill *all* MaraDNS processes | |
| if [ $1 = "stop" -o $1 = "restart" ] ; then | |
| echo Sending all MaraDNS processes the TERM signal | |
| ps -ef | awk '{print $2":"$8}' | grep maradns | grep -v $$ | \ | |
| cut -f1 -d: | xargs kill > /dev/null 2>&1 | |
| echo waiting 1 second | |
| sleep 1 | |
| echo Sending all MaraDNS processes the KILL signal | |
| ps -e | awk '{print $1":"$NF}' | grep maradns | grep -v $$ | \ | |
| cut -f1 -d: | xargs kill -9 > /dev/null 2>&1 | |
| echo MaraDNS should have been stopped | |
| if [ $1 = "stop" ] ; then | |
| exit 0 | |
| fi | |
| fi | |
| # If invoked as start or restart, start the MaraDNS processes | |
| if [ $1 = "start" -o $1 = "restart" ] ; then | |
| echo Starting all maradns processes | |
| for a in $MARARCS ; do | |
| echo Starting maradns process which uses Mararc file $a | |
| # Duende syslogs MaraDNS' output messages and daemonizes MaraDNS | |
| $DUENDE $MARADNS -f $a | |
| done | |
| exit 0 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # 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/Deadwood programs | |
| # use the path applicable to your system | |
| MARADNS="/usr/local/sbin/maradns" | |
| DEADWOOD="/usr/local/sbin/Deadwood" | |
| # The following is a pointer to the duende daemonizer | |
| # use the path applicable to your system | |
| DUENDE="/usr/local/sbin/duende" | |
| # 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" | |
| # Show usage information if this script is invoked with no arguments | |
| if [ $# -lt 1 ] ; then | |
| echo Usage: $0 \(start\|stop\|restart\) | |
| exit 1 | |
| fi | |
| send_term () { | |
| ps -ef | awk '{print $2":"$8}' | grep $2 | grep -v $$ | \ | |
| cut -f1 -d: | xargs kill > /dev/null 2>&1 | |
| } | |
| send_kill () { | |
| ps -e | awk '{print $1":"$NF}' | grep $2 | grep -v $$ | \ | |
| cut -f1 -d: | xargs kill -9 > /dev/null 2>&1 | |
| } | |
| # If invoked as stop or restart, kill *all* MaraDNS processes | |
| if [ $1 = "stop" -o $1 = "restart" ] ; then | |
| echo Sending all MaraDNS/Deadwood processes the TERM signal | |
| send_term $1 maradns | |
| send_term $1 Deadwood | |
| echo waiting 1 second | |
| sleep 1 | |
| echo Sending all MaraDNS/Deadwood processes the KILL signal | |
| send_kill $1 maradns | |
| send_kill $1 Deadwood | |
| echo MaraDNS/Deadwood should have been stopped | |
| if [ $1 = "stop" ] ; then | |
| exit 0 | |
| fi | |
| fi | |
| # If invoked as start or restart, start the MaraDNS processes | |
| if [ $1 = "start" -o $1 = "restart" ] ; then | |
| echo Starting maradns and Deadwood processes | |
| echo "Starting maradns process that uses default /etc/mararc" | |
| # Duende syslogs MaraDNS' output messages and daemonizes MaraDNS | |
| $DUENDE $MARADNS | |
| echo "Starting Deadwood process that uses default /etc/dwood3rc" | |
| $DUENDE $DEADWOOD | |
| exit 0 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment