Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 May 2006 12:35:09 -0700
From:      Doug Barton <dougb@FreeBSD.org>
To:        Serge Gagnon <serge.gagnon@b2b2c.ca>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: rc.d question
Message-ID:  <4477586D.3030803@FreeBSD.org>
In-Reply-To: <0IZV00DDIY8N1Q40@VL-MH-MR002.ip.videotron.ca>
References:  <0IZV00DDIY8N1Q40@VL-MH-MR002.ip.videotron.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
Serge Gagnon wrote:
> Hi,
> I have a port that can be launch in two way simulaneously like:
> webserver -p80    and
> webserver -p443 -s
> 
> I would like to know if the better way is to make to different rc.d script 
> like
> webcit and webcit-ssl or to try to handle this in just one with args ? I'm 
> in favor to make two different one because it's less complicated.

It's preferred that the PROVIDE line, $name variable, and the name of the
script all match. So, unless the service will be called webcit-ssl if it's
launched that way, the answer is that one script is better.

If I were you, I'd approach the problem this way (assuming that without SSL
is the more common case):

#!/bin/sh

# PROVIDE: webcit
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# webcit_enable (bool):	Set to NO by default.
# 			Set it to YES to enable webcit
# webcit_ssl (bool):	Set to YES to run SSL version too
#

. %%RC_SUBR%%

name=webcit
rcvar=${name}_enable

command="%%PREFIX%%/sbin/${name}"
command_args="-p80"

start_postcmd="${name}_poststart"

webcit_poststart()
{
	[ -n "$webcit_ssl" ] && $command -p443 -s
}

load_rc_config $name

: ${webcit_enable="NO"}

run_rc_command "$1"



hope this helps,

Doug

-- 

    This .signature sanitized for your protection




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4477586D.3030803>