rc.d question
Doug Barton
dougb at FreeBSD.org
Fri May 26 12:35:21 PDT 2006
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
More information about the freebsd-ports
mailing list