summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-dns/knot/files/knot.init')
-rw-r--r--net-dns/knot/files/knot.init43
1 files changed, 43 insertions, 0 deletions
diff --git a/net-dns/knot/files/knot.init b/net-dns/knot/files/knot.init
new file mode 100644
index 000000000000..cf73f6240454
--- /dev/null
+++ b/net-dns/knot/files/knot.init
@@ -0,0 +1,43 @@
+#!/sbin/runscript
+
+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
+
+ ebegin "Starting knot-dns"
+ /usr/sbin/knotc start
+ eend $?
+}
+
+stop() {
+ ebegin "Stoping knot-dns"
+ /usr/sbin/knotc stop
+ eend $?
+}
+
+restart() {
+ ebegin "Restarting knot-dns"
+ /usr/sbin/knotc restart
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading knot-dns"
+ /usr/sbin/knotc reload
+ eend $?
+}