From: Bert Hubert Date: Wed, 19 Apr 2006 19:47:38 +0000 (+0000) Subject: add init.d script, install it X-Git-Tag: rec-3-0~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a3a6f9d44ea1892b33948251525038e85cc6356;p=pdns add init.d script, install it add manpages to .deb, .rpm and tar.bz2 make rec_control exit with a meaningful error git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@745 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/Makefile-recursor b/pdns/Makefile-recursor index b775a20a6..ea7bc12e5 100644 --- a/pdns/Makefile-recursor +++ b/pdns/Makefile-recursor @@ -47,7 +47,9 @@ install: all install -s rec_control $(DESTDIR)/$(BINDIR) -mkdirhier $(DESTDIR)/$(CONFIGDIR) ./pdns_recursor --config > $(DESTDIR)/$(CONFIGDIR)/recursor.conf - + -mkdirhier $(DESTDIR)/usr/share/man/man1 + cp pdns_recursor.1 rec_control.1 $(DESTDIR)/usr/share/man/man1 + $(OS_SPECIFIC_INSTALL) clean: -rm -f *.o *~ pdns_recursor rec_control optional/*.o diff --git a/pdns/dist-recursor b/pdns/dist-recursor index 72a121551..f5cce9121 100755 --- a/pdns/dist-recursor +++ b/pdns/dist-recursor @@ -12,6 +12,10 @@ recursor_cache.cc dnsparser.cc dnswriter.cc dnsrecords.cc rcpgenerator.cc \ base64.cc zoneparser-tng.cc rec_channel.cc rec_channel_rec.cc rec_control.cc \ selectmplexer.cc epollmplexer.cc kqueuemplexer.cc portsmplexer.cc" +cd docs +make pdns_recursor.1 rec_control.1 +cd .. + DIRNAME=pdns-recursor-$VERSION rm -rf $DIRNAME mkdir $DIRNAME @@ -23,6 +27,8 @@ cp config-recursor.h $DIRNAME/config.h mkdir $DIRNAME/rrd cp tools/rrd/{create,update,makegraphs,index.html} $DIRNAME/rrd cp ext/nedmalloc/malloc.c $DIRNAME +cp pdns-recursor.init.d $DIRNAME +cp docs/pdns_recursor.1 docs/rec_control.1 $DIRNAME mkdir -p $DIRNAME/sysdeps cp sysdeps-recursor/* $DIRNAME/sysdeps diff --git a/pdns/docs/Makefile b/pdns/docs/Makefile index b32e6957b..0c5ee6a3a 100644 --- a/pdns/docs/Makefile +++ b/pdns/docs/Makefile @@ -6,7 +6,7 @@ pdns-expanded.sgml: pdns.sgml ./expand < $< > $@ clean: - rm -rf *.dvi *.pdf *.tex *.toc *.aux *.txt *.ps *.bak *.tmp *~ *.log html.tar.gz html pdns + rm -rf *.xml *.dvi *.pdf *.tex *.toc *.aux *.ps *.bak *.tmp *~ *.log html.tar.gz html pdns html/index.html: pdns-expanded.sgml db2html -V %use-id-as-filename% -o html $< @@ -22,6 +22,15 @@ html.tar.gz: html/index.html docbook2pdf $< mv pdns-expanded.pdf pdns.pdf +%.xml: %.txt + asciidoc -b docbook -d manpage $< + +%: %.xml + xmlto man $< + +%.html: %.txt + asciidoc -b xhtml11 -d manpage $< + publish: rsync --copy-links --delete -avrze ssh ./html pdns.txt pdns.pdf \ exit.powerdns.com:/opt/websites/downloads.powerdns.com/www/documentation/ diff --git a/pdns/pdns-recursor.init.d b/pdns/pdns-recursor.init.d new file mode 100755 index 000000000..31c93b83e --- /dev/null +++ b/pdns/pdns-recursor.init.d @@ -0,0 +1,89 @@ +#!/bin/sh +# chkconfig: - 80 75 +# description: pdns_recursor is a versatile high performance recursing nameserver + +prefix=/usr/ +BINARYPATH=/usr/bin/ +SBINARYPATH=/usr/sbin/ +SOCKETPATH=/var/run + +pdns_server=$SBINARYPATH/pdns_recursor + +[ -f "$pdns_server" ] || exit 0 + +doPC() +{ + ret=$($BINARYPATH/rec_control $EXTRAOPTS $1 $2 2> /dev/null) +} + + +doPC ping +NOTRUNNING=$? + +case "$1" in + status) + if test "$NOTRUNNING" = "0" + then + echo "running" + else + echo "not running" + fi + ;; + + stop) + echo -n "Stopping PowerDNS recursing nameserver: " + if test "$NOTRUNNING" = "0" + then + doPC quit + echo $ret + else + echo "not running" + fi + ;; + + + force-stop) + echo -n "Stopping PowerDNS recursing nameserver: " + killall -v -9 pdns_server + echo "killed" + ;; + + start) + echo -n "Starting PowerDNS recursing nameserver: " + if test "$NOTRUNNING" = "0" + then + echo "already running" + else + $pdns_server --daemon + if test "$?" = "0" + then + echo "started" + fi + fi + ;; + + force-reload | restart) + echo -n "Restarting PowerDNS authoritative nameserver: " + echo -n stopping and waiting.. + doPC quit + sleep 3 + echo done + $0 start + ;; + + monitor) + if test "$NOTRUNNING" = "0" + then + echo "already running" + else + $pdns_server --daemon=no --quiet=no --control-console --loglevel=9 + fi + ;; + + *) + echo pdns [start\|stop\|force-reload\|restart\|status\|monitor] + + ;; +esac + + diff --git a/pdns/pdns-recursor.spec b/pdns/pdns-recursor.spec index 5a0813a83..e74eb7832 100644 --- a/pdns/pdns-recursor.spec +++ b/pdns/pdns-recursor.spec @@ -2,7 +2,7 @@ Buildroot: /tmp/pdns/ Name: pdns-recursor -Version: 3.0_pre3 +Version: 3.0_pre4 Release: 1 Summary: extremely powerful and versatile recursing nameserver Copyright: see /usr/doc/pdns/copyright @@ -34,6 +34,9 @@ This RPM is semi-statically compiled and should work on all Linux distributions. %defattr(-,root,root) "/usr/sbin/pdns_recursor" "/usr/bin/rec_control" +"/etc/init.d/pdns-recursor" +"/usr/share/man/man1/pdns_recursor.1.gz" +"/usr/share/man/man1/rec_control.1.gz" %dir "/etc/powerdns/" %config(noreplace) "/etc/powerdns/recursor.conf" diff --git a/pdns/rec_control.cc b/pdns/rec_control.cc index 903b27320..6f9c71974 100644 --- a/pdns/rec_control.cc +++ b/pdns/rec_control.cc @@ -68,8 +68,10 @@ try rccS.send(command); string receive=rccS.recv(); cout<