Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Sep 2014 02:39:26 -0500
From:      Scot Hetzel <swhetzel@gmail.com>
To:        Sergey Zhmylove <korg@cs.ifmo.ru>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: dnrd rc script
Message-ID:  <CACdU%2Bf-WGgQojAPygJRS7MTG1Q%2Bj3VYtn6UNbaz9t87L=hk9Zg@mail.gmail.com>
In-Reply-To: <540CB099.80009@cs.ifmo.ru>
References:  <540CB099.80009@cs.ifmo.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Sep 7, 2014 at 2:23 PM, Sergey Zhmylove <korg@cs.ifmo.ru> wrote:
> Hello!
>
> Please can you tell me, what should I do if I wanna propose a small patch
> for dns/dnrd rc script?
> I've read porters-handbook and there is recommendation to use this e-mail
> list.
> Smth like this:
>
> --- dnrd        2014-09-07 22:25:56.036338143 +0400
> +++ dnrd.new    2014-09-07 23:16:46.223328451 +0400
> @@ -22,6 +22,8 @@
>
>  load_rc_config ${name}
>
> +command_args="$dnrd_args"
> +
>  case $1 in
>         "stop")
>                 echo "Stopping dnrd."
>
If you want the user to add additional args when starting the script,
they just need to use dnrd_flags.

command_args is used mostly for when you want the script to always use
these args when starting the service.

Also, the 'case $1 in .. esac' statement (shown above), shouldn't be
needed if you use stop_cmd:

#!/bin/sh

# $FreeBSD$
#
# PROVIDE: dnrd
# REQUIRE: DAEMON NETWORKING SERVERS
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable dnrd:
#
# dnrd_enable="YES"

# override these variables in /etc/rc.conf
dnrd_enable=${dnrd_enable-"NO"}

# you may also define dnrd_flags to specify additional args to start
dnrd with in /etc/rc.conf..

. /etc/rc.subr

name=dnrd
rcvar=dnrd_enable
stop_cmd="dnrd_stop"

command=%%PREFIX%%/sbin/${name}
pidfile=/var/run/${name}.pid

dnrd_stop() {
 ${command} -k
}

load_rc_config ${name}
run_rc_command "$1"

The current script will try to stop dnrd, even when it is not running.
This has the benefit of not trying to stop dnrd when it is not
enabled.

-- 
DISCLAIMER:

No electrons were maimed while sending this message. Only slightly bruised.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACdU%2Bf-WGgQojAPygJRS7MTG1Q%2Bj3VYtn6UNbaz9t87L=hk9Zg>