summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Chvatal <scarabeus@gentoo.org>2013-08-21 09:24:24 +0000
committerTomas Chvatal <scarabeus@gentoo.org>2013-08-21 09:24:24 +0000
commit4fdce4d7abe20587e95f7335ee7d1edfd4f1703d (patch)
tree4664137516acd6a8648cfefbd358931d376fe55e /net-dns/knot/files
parentversion bump, drop old (diff)
downloadhistorical-4fdce4d7abe20587e95f7335ee7d1edfd4f1703d.tar.gz
historical-4fdce4d7abe20587e95f7335ee7d1edfd4f1703d.tar.bz2
historical-4fdce4d7abe20587e95f7335ee7d1edfd4f1703d.zip
Update initscript so it actually works. Again thanks to Ondrej.
Package-Manager: portage-2.2.0/cvs/Linux x86_64 Manifest-Sign-Key: 0x8EEE3BE8
Diffstat (limited to 'net-dns/knot/files')
-rw-r--r--net-dns/knot/files/knot.init51
1 files changed, 25 insertions, 26 deletions
diff --git a/net-dns/knot/files/knot.init b/net-dns/knot/files/knot.init
index cf73f6240454..42eae81844e1 100644
--- a/net-dns/knot/files/knot.init
+++ b/net-dns/knot/files/knot.init
@@ -1,43 +1,42 @@
#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-dns/knot/files/knot.init,v 1.2 2013/08/21 09:23:59 scarabeus Exp $
+
+command=/usr/sbin/knotd
+command_args="-d"
+pidfile=/var/run/knot/knot.pid
+required_files=/etc/knot/knot.conf
+extra_started_commands="reload"
+description_reload="Reload configuration and changed zones."
depend() {
need net
}
-check_config() {
- # we need to ensure that var is created for runtime
- if [ ! -d /var/lib/knot/ ]; then
- mkdir -p /var/lib/knot/
- fi
- # without config dns is kinda useless
- if [ ! -f /etc/knot/knot.conf ]; then
- eerror "This script requires configured knot-dns at /etc/knot/knot.conf."
- return 1
- fi
-}
-
start() {
- check_config || return 1
+ checkpath -d -m 0750 -o knot:knot /var/run/knot/ /var/lib/knot/
- ebegin "Starting knot-dns"
- /usr/sbin/knotc start
+ ebegin "Starting knot"
+ start-stop-daemon --start \
+ --pidfile $pidfile --exec $command -- $command_args
eend $?
}
stop() {
- ebegin "Stoping knot-dns"
- /usr/sbin/knotc stop
- eend $?
-}
-
-restart() {
- ebegin "Restarting knot-dns"
- /usr/sbin/knotc restart
- eend $?
+ ebegin "Stoping knot"
+ /usr/sbin/knotc stop >/dev/null 2>&1
+ # In case remote control is not working
+ if [ "$?" != 0 ]; then
+ if [ -f $pidfile ]; then
+ start-stop-daemon --stop --pidfile $pidfile
+ fi
+ fi
+ ewend $?
}
reload() {
- ebegin "Reloading knot-dns"
- /usr/sbin/knotc reload
+ ebegin "Reloading knot"
+ /usr/sbin/knotc reload >/dev/null
eend $?
}