lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

knotd.init (755B)


      1 #!/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 
      7 START=50
      8 USE_PROCD=1
      9 
     10 PROG="/usr/sbin/knotd"
     11 CONFFILE="/etc/knot/knot.conf"
     12 
     13 USER="knot"
     14 USERID="5353"
     15 RUNDIR="/var/run/knot"
     16 STORAGE="/var/lib/knot"
     17 
     18 fix_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 
     33 start_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 }