FreeBSD Bugzilla – Attachment 252079 Details for
Bug 277540
dns/knot-resolver: fixing rc scripts krescachegc and kresd
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
knot-resolver rc and etc.
knot-resolver.diff (text/plain), 4.78 KB, created by
Leo Vandewoestijne
on 2024-07-15 14:11:24 UTC
(
hide
)
Description:
knot-resolver rc and etc.
Filename:
MIME Type:
Creator:
Leo Vandewoestijne
Created:
2024-07-15 14:11:24 UTC
Size:
4.78 KB
patch
obsolete
>diff --git a/dns/knot-resolver/files/krescachegc.in b/dns/knot-resolver/files/krescachegc.in >index 40334bea0..a633a0728 100644 >--- a/dns/knot-resolver/files/krescachegc.in >+++ b/dns/knot-resolver/files/krescachegc.in >@@ -18,16 +18,58 @@ name=krescachegc > rcvar=krescachegc_enable > > load_rc_config ${name} >+load_rc_config_var kresd rundir >+load_rc_config_var kresd user > >-# set defaults >-krescachegc_enable=${krescachegc_enable:-"NO"} >+: ${krescachegc_enable:="NO"} > : ${krescachegc_svcj_options:="net_basic"} >-krescachegc_millis=${krescachegc_millis:-"1000"} >+: ${krescachegc_millis:="1000"} >+: ${kresd_rundir:="/var/run/kresd"} >+: ${kresd_user:="%%USERS%%"} > >-pidfile="%%RUNDIR%%/${name}.pid" > procname="%%PREFIX%%/sbin/kres-cache-gc" > >+start_cmd="${name}_start" >+status_cmd="${name}_status" >+stop_cmd="${name}_stop" >+ > command=/usr/sbin/daemon >-command_args="-c -f -S -r -P ${pidfile} -T ${name} -u %%USERS%% -- ${procname} -d ${krescachegc_millis}" >+command_args="-c -f -r -S -u ${kresd_user} -T ${name} -- ${procname} -c ${kresd_rundir} -d ${krescachegc_millis}" >+ >+krescachegc_start() { >+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?" >+ if [ "${status}" -eq 0 ]; then >+ echo "${name} already seems to be running." >+ else >+ echo "starting ${name}..." && \ >+ ${command} ${command_args} >+ echo -e "\e[1A\e[K${name} started." >+ fi >+ } >+ >+krescachegc_status() { >+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?" >+ if [ "${status}" -eq 0 ]; then >+ echo "${name} is running:" >+ echo >+ /bin/ps -p $(/bin/pgrep -f ${procname}) >+ else >+ echo "${name} is not running" >+ fi >+ return ${status} >+ } >+ >+krescachegc_stop() { >+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?" >+ if [ "${status}" -eq 0 ]; then >+ echo "stopping ${name}..." && \ >+ /bin/pkill -TERM -f ${procname} >+ echo -e "\e[1A\e[K${name} stopped." >+ >+ else >+ echo "${name} is not running" >+ fi >+ return ${status} >+ } > > run_rc_command "$1" >diff --git a/dns/knot-resolver/files/kresd.in b/dns/knot-resolver/files/kresd.in >index 0ddd5d332..c322d5e85 100644 >--- a/dns/knot-resolver/files/kresd.in >+++ b/dns/knot-resolver/files/kresd.in >@@ -20,57 +20,59 @@ rcvar=kresd_enable > > load_rc_config ${name} > >-# set defaults >-kresd_enable=${kresd_enable:-"NO"} >+: ${kresd_enable:="NO"} > : ${kresd_svcj_options:="net_basic"} >-kresd_config=${kresd_config:-"%%ETCDIR%%/${name}.conf"} >-kresd_user="%%USERS%%" >-kresd_group="%%GROUPS%%" >-kresd_rundir="/var/run/${name}" >+: ${kresd_config:="%%ETCDIR%%/${name}.conf"} >+: ${kresd_user:="%%USERS%%"} >+: ${kresd_group:="%%GROUPS%%"} >+: ${kresd_rundir:="%%RUNDIR%%"} > >-pidfile="${kresd_rundir}/${name}.pid" > procname="%%PREFIX%%/sbin/${name}" > required_files="${kresd_config}" > > start_cmd="${name}_start" >+status_cmd="${name}_status" > stop_cmd="${name}_stop" > > command="/usr/sbin/daemon" >-command_args="-c -f -S -r -P ${pidfile} -T ${name} -- ${procname} -c ${kresd_config} -n -q ${kresd_rundir}" >+command_args="-c -f -r -S -T ${name} -- ${procname} -c ${kresd_config} -n -q ${kresd_rundir}" > > kresd_start() { > if [ ! -d /var/run/${name} ]; then > install -d -o ${kresd_user} -g ${kresd_group} -m 700 ${kresd_rundir} > fi >- if [ ! -f "${pidfile}" ]; then >+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?" >+ if [ "${status}" -eq 0 ]; then >+ echo "${name} already seems to be running." >+ else > echo "starting ${name}..." && \ > ${command} ${command_args} > echo -e "\e[1A\e[K${name} started." >+ fi >+ } >+ >+kresd_status() { >+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?" >+ if [ "${status}" -eq 0 ]; then >+ echo "${name} is running:" >+ echo >+ /bin/ps -p $(/bin/pgrep -f ${procname}) > else >- echo "${name} already seems to be running." >+ echo "${name} is not running" > fi >+ return ${status} > } > > kresd_stop() { >- if [ -f "${pidfile}" ]; then >+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?" >+ if [ "${status}" -eq 0 ]; then > echo "stopping ${name}..." && \ >- for pid in `ps waux | grep ${procname} | grep daemon | awk '{print $2}'`; do \ >- kill -TERM $pid >- done >+ /bin/pkill -TERM -f ${procname} > echo -e "\e[1A\e[K${name} stopped." > else >- echo "${name} seems to be not running." >+ echo "${name} is not running" > fi >+ return ${status} > } > >-kresd_status() { >- if [ -e "${pidfile}" ]; then >- echo "${name} is running on pid $(cat $pidfile)." >- return 1 >- else >- echo "${name} is not running." >- return 0 >- fi >-} >- > run_rc_command "$1" >diff --git a/dns/knot-resolver/pkg-plist b/dns/knot-resolver/pkg-plist >index 769c84a35..7ee88fee5 100644 >--- a/dns/knot-resolver/pkg-plist >+++ b/dns/knot-resolver/pkg-plist >@@ -96,4 +96,4 @@ sbin/kres-cache-gc > sbin/kresc > sbin/kresd > @dir(%%USERS%%,%%GROUPS%%,0755) %%ETCDIR%% >-@dir(%%USERS%%,%%GROUPS%%,0660) %%RUNDIR%% >+@dir(%%USERS%%,%%GROUPS%%,0700) %%RUNDIR%%
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
freebsd
:
maintainer-approval+
Actions:
View
|
Diff
Attachments on
bug 277540
:
248987
|
251816
|
252079
|
252511
|
252613