You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
755 B

  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. START=50
  7. USE_PROCD=1
  8. PROG="/usr/sbin/knotd"
  9. CONFFILE="/etc/knot/knot.conf"
  10. USER="knot"
  11. USERID="5353"
  12. RUNDIR="/var/run/knot"
  13. STORAGE="/var/lib/knot"
  14. fix_perms() {
  15. user_exists $USER $USERID || user_add $USER $USERID
  16. group_exists $USER $USERID || group_add $USER $USERID
  17. for dir in $RUNDIR $STORAGE; do
  18. test -e $dir || {
  19. mkdir -p $dir
  20. chgrp $USER $dir
  21. chmod g+w $dir
  22. }
  23. chgrp $USER $CONFFILE
  24. chmod g+r $CONFFILE
  25. done
  26. }
  27. start_service() {
  28. fix_perms
  29. procd_open_instance
  30. procd_set_param command $PROG -c $CONFFILE
  31. procd_set_param respawn
  32. procd_close_instance
  33. }