Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Sep 2009 19:35:50 +0200
From:      Mel Flynn <mel.flynn+fbsd.questions@mailing.thruhere.net>
To:        freebsd-questions@freebsd.org
Cc:        Tom Worster <fsb@thefsb.org>
Subject:   Re: passing options thru '/etc/rc.d/foo start'
Message-ID:  <200909161935.50758.mel.flynn%2Bfbsd.questions@mailing.thruhere.net>
In-Reply-To: <C6D68E69.127BA%fsb@thefsb.org>
References:  <C6D68E69.127BA%fsb@thefsb.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 16 September 2009 18:45:29 Tom Worster wrote:
> is there a general shell syntax that can be used to pass arguments to a
> daemon that you're starting with the /etc/rc.d/foo start command?
> 
> for example, how does one start sshd using /etc/rc.d/sshd and pass it
> '-o X11Forwarding=no' without touching a config file?

You don't. Defaults are set in /etc/defaults/rc.conf, overridden in 
/etc/rc.conf. Unless you add the logic yourself in /etc/rc.conf, the 
environment is not looked at.
So this means a one-time edit of /etc/rc.conf:
if test -n "${SSHD_FLAGS}"; then
	sshd_flags="${SSHD_FLAGS}"
else
	sshd_flags="${sshd_flags}"
fi

Then start with SSHD_FLAGS="-o X11Forwarding=no" /etc/rc.d/sshd start

But this is specific for sshd, as it supports _flags. There's no generic way 
to do this.
-- 
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909161935.50758.mel.flynn%2Bfbsd.questions>