0
0
mirror of https://github.com/openwrt/packages.git synced 2025-02-07 09:19:51 +00:00
packages/net/knot/files/knotd.init
Daniel Salzman 4a54847916 knot: update to 2.1.1
Signed-off-by: Daniel Salzman <daniel.salzman@nic.cz>
2016-02-15 12:51:53 +01:00

40 lines
755 B
Bash

#!/bin/sh /etc/rc.common
#
# Copyright (C) 2014-2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
#
# This is free software, licensed under the GNU General Public License v2.
START=50
USE_PROCD=1
PROG="/usr/sbin/knotd"
CONFFILE="/etc/knot/knot.conf"
USER="knot"
USERID="5353"
RUNDIR="/var/run/knot"
STORAGE="/var/lib/knot"
fix_perms() {
user_exists $USER $USERID || user_add $USER $USERID
group_exists $USER $USERID || group_add $USER $USERID
for dir in $RUNDIR $STORAGE; do
test -e $dir || {
mkdir -p $dir
chgrp $USER $dir
chmod g+w $dir
}
chgrp $USER $CONFFILE
chmod g+r $CONFFILE
done
}
start_service() {
fix_perms
procd_open_instance
procd_set_param command $PROG -c $CONFFILE
procd_set_param respawn
procd_close_instance
}