]> git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blob - src/initscripts/packages/dnsdist
core164: exclude boot/uEnv.txt
[people/mfischer/ipfire-2.x.git] / src / initscripts / packages / dnsdist
1 #!/bin/sh
2 ########################################################################
3 # Begin $rc_base/init.d/dnsdist
4 #
5 # Description : dnsdist - A DNS load-balancer and more
6 #
7 ########################################################################
8
9 . /etc/sysconfig/rc
10 . ${rc_functions}
11
12 [ -r "/etc/sysconfig/dnsdist" ] && . /etc/sysconfig/dnsdist
13
14 check_config() {
15 if ! /usr/bin/dnsdist --check-config >/dev/null; then
16 boot_mesg "dnsdist configuration file contains errors" "${FAILURE}"
17 echo_failure
18 return 1
19 fi
20
21 return 0
22 }
23
24 case "${1}" in
25 start)
26 if ! check_config; then
27 exit 1
28 fi
29
30 boot_mesg "Starting dnsdist..."
31
32 # Increasing maximum number of open files
33 ulimit -n 65536
34
35 # Starting daemon
36 /usr/bin/dnsdist --supervised ${ARGS} >/dev/null &
37 evaluate_retval
38 ;;
39
40 stop)
41 boot_mesg "Stopping dnsdist..."
42 killproc /usr/bin/dnsdist
43 ;;
44
45 reload)
46 if ! check_config; then
47 exit 1
48 fi
49
50 boot_mesg "Reloading dnsdist..."
51 reloadproc /usr/bin/dnsdist
52 ;;
53
54 restart)
55 if ! check_config; then
56 exit 1
57 fi
58
59 ${0} stop
60 sleep 1
61 ${0} start
62 ;;
63
64 status)
65 statusproc /usr/bin/dnsdist
66 ;;
67
68 *)
69 echo "Usage: ${0} {start|stop|reload|restart|status}"
70 exit 1
71 ;;
72 esac
73
74 # End $rc_base/init.d/dnsdist