]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/initscripts/packages/dnsdist
Early spring clean: Remove trailing whitespaces, and correct licence headers
[people/pmueller/ipfire-2.x.git] / src / initscripts / packages / dnsdist
CommitLineData
98b8cabf 1#!/bin/sh
66c36198
PM
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
98b8cabf
MT
21
22. /etc/sysconfig/rc
23. ${rc_functions}
24
25[ -r "/etc/sysconfig/dnsdist" ] && . /etc/sysconfig/dnsdist
26
839451c5
MT
27check_config() {
28 if ! /usr/bin/dnsdist --check-config >/dev/null; then
29 boot_mesg "dnsdist configuration file contains errors" "${FAILURE}"
30 echo_failure
31 return 1
32 fi
33
34 return 0
35}
36
98b8cabf
MT
37case "${1}" in
38 start)
839451c5
MT
39 if ! check_config; then
40 exit 1
41 fi
42
98b8cabf 43 boot_mesg "Starting dnsdist..."
4f66bad4
MT
44
45 # Increasing maximum number of open files
46 ulimit -n 65536
47
48 # Starting daemon
fd0b2742
MT
49 /usr/bin/dnsdist --supervised ${ARGS} >/dev/null &
50 evaluate_retval
98b8cabf
MT
51 ;;
52
53 stop)
54 boot_mesg "Stopping dnsdist..."
55 killproc /usr/bin/dnsdist
56 ;;
57
58 reload)
839451c5
MT
59 if ! check_config; then
60 exit 1
61 fi
62
98b8cabf
MT
63 boot_mesg "Reloading dnsdist..."
64 reloadproc /usr/bin/dnsdist
65 ;;
66
67 restart)
839451c5
MT
68 if ! check_config; then
69 exit 1
70 fi
71
98b8cabf
MT
72 ${0} stop
73 sleep 1
74 ${0} start
75 ;;
76
77 status)
78 statusproc /usr/bin/dnsdist
79 ;;
80
81 *)
82 echo "Usage: ${0} {start|stop|reload|restart|status}"
83 exit 1
84 ;;
85esac