45 lines
667 B

  1. #!/bin/sh /etc/rc.common
  2. START=70
  3. knot_bin="/usr/sbin/knotd"
  4. knot_ctl="/usr/sbin/knotc"
  5. config_file="/etc/knot/knot.conf"
  6. pid_file="/var/run/knot.pid"
  7. start() {
  8. echo "Starting Knot DNS"
  9. if [ -e $pid_file ]; then
  10. echo " Already running with PID `cat $pid_file`"
  11. return 1
  12. fi
  13. $knot_bin -c $config_file -d
  14. if [ $? -ne 0 ]; then
  15. echo " Failed to start"
  16. fi
  17. }
  18. stop() {
  19. echo "Stopping Knot DNS"
  20. if [ -e $pid_file ]; then
  21. kill `cat $pid_file`
  22. rm -f $pid_file
  23. else
  24. echo " No PID file $pid_file"
  25. return 1
  26. fi
  27. }
  28. restart() {
  29. stop
  30. start
  31. }
  32. reload() {
  33. echo "Reloading Knot DNS"
  34. $knot_ctl -c $config_file reload
  35. }