blob: 0e5bf03f4dac2053535896d78d2467324c0b1c54 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#!/bin/sh /etc/rc.common
2#
3# Copyright (C) 2014-2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
4#
5# This is free software, licensed under the GNU General Public License v2.
6
7START=50
8USE_PROCD=1
9
10PROG="/usr/sbin/knotd"
11CONFFILE="/etc/knot/knot.conf"
12
13USER="knot"
14USERID="5353"
15RUNDIR="/var/run/knot"
16STORAGE="/var/lib/knot"
17
18fix_perms() {
19 user_exists $USER $USERID || user_add $USER $USERID
20 group_exists $USER $USERID || group_add $USER $USERID
21
22 for dir in $RUNDIR $STORAGE; do
23 test -e $dir || {
24 mkdir -p $dir
25 chgrp $USER $dir
26 chmod g+w $dir
27 }
28 chgrp $USER $CONFFILE
29 chmod g+r $CONFFILE
30 done
31}
32
33start_service() {
34 fix_perms
35 procd_open_instance
36 procd_set_param command $PROG -c $CONFFILE
37 procd_set_param respawn
38 procd_close_instance
39}