View | Details | Raw Unified | Return to bug 256221 | Differences between
and this patch

Collapse All | Expand All

(-)b/dns/knot-resolver/files/kresd.in (-6 / +46 lines)
Lines 20-35 rcvar=kresd_enable Link Here
20
20
21
load_rc_config ${name}
21
load_rc_config ${name}
22
22
23
# set defaults
24
25
kresd_enable=${kresd_enable:-"NO"}
23
kresd_enable=${kresd_enable:-"NO"}
26
kresd_config=${kresd_config:-"%%ETCDIR%%/${name}.conf"}
24
kresd_config=${kresd_config:-"/usr/local/etc/knot-resolver/${name}.conf"}
25
kresd_rundir="/var/run/kresd"
27
26
28
pidfile="%%RUNDIR%%/${name}.pid"
27
pidfile="/var/run/kresd/${name}.pid"
29
procname="%%PREFIX%%/sbin/${name}"
28
procname="/usr/local/sbin/${name}"
30
required_files="${kresd_config}"
29
required_files="${kresd_config}"
30
kuser=${name}
31
kgroup=$name}
32
33
restart_cmd="${name}_restart"
34
start_cmd="${name}_start"
35
stop_cmd="${name}_stop"
31
36
32
command="/usr/sbin/daemon"
37
command="/usr/sbin/daemon"
33
command_args="-c -f -S -r -P ${pidfile} -- ${procname} -c ${kresd_config} -n -q %%RUNDIR%%"
38
command_args="-c -f -S -r -P ${pidfile} -- ${procname} -c ${kresd_config} -n -q ${kresd_rundir}"
39
40
kresd_restart() {
41
	if [ -f "${pidfile}" ]; then
42
		printf "restarting ${name}...\n\n"
43
		run_rc_command stop
44
		run_rc_command start
45
	else
46
		printf "Hmm... ${name} isn't running.\n\n"
47
		run_rc_command start
48
	fi
49
}
50
kresd_start()
51
{
52
	if [ ! -d /var/run/${name} ]; then
53
		install -d -o ${kuser} -g ${kgroup} /var/run/${name}
54
	elif [ ! -f "${pidfile}" ]; then
55
		echo "starting ${name}..." && \
56
		${command} ${command_args}
57
		printf "\n${name} started.\n"
58
	else
59
		echo "Nothing to do. ${name} is already running."
60
	fi
61
}
62
kresd_stop() {
63
	if [ -f "${pidfile}" ]; then
64
		echo "stopping ${name}..." && \
65
		for pid in `ps waux | grep ${name} | grep daemon | awk '{print $2}'`; \
66
		do \
67
		kill -TERM $pid
68
		printf "\n${name} stopped.\n\n"
69
		done
70
	else
71
		echo "Nothing to do. ${name} isn't running."
72
	fi
73
}
34
74
35
run_rc_command "$1"
75
run_rc_command "$1"

Return to bug 256221