If not the force, what should I use?

Mike Meyer mwm-keyword-freebsdhackers2.e313df at mired.org
Wed Aug 13 12:01:58 UTC 2008


On Wed, 13 Aug 2008 12:27:30 +0200
Jonathan McKeown <jonathan+freebsd-hackers at hst.org.za> wrote:

> On Wednesday 13 August 2008 10:40:53 Vincent Hoffman wrote:
> > Jonathan McKeown wrote:
> > > People keep talking about forcestart.
> > >
> > > Unless I'm misunderstanding things horribly, forcestart does exactly that
> > > - forces the service to start regardless of any error that may occur.
> > >
> > > The better option for starting something as a one-off (not enabled in
> > > rc.conf) is mnemonically named onestart - which only ignores the rcvar
> > > but still fails on any other error.
> > >
> > > And yes, I like having onestart/onestop distinguished from start/stop.
> >
> > I believe it "forces" a start even though its not actually enabled (in
> > rc.conf) rather than regardless of errors.
> > If you really want a command line of onestart/onestop install the
> > sysutils/bsdadminscripts port which has a script called rconestart and
> > rconestop which do exactly that ;)
> 
> No, you don't need to install anything - it's part of rc.subr.
> 
> From the rc.subr(8) manpage:
> 
>         argument may have one of the following prefixes which alters its
>         operation:
> 
>              fast   Skip the check for an existing running process, and
>                     sets rc_fast=YES.
> 
>              force  Skip the checks for rcvar being set to ``YES'', and
>                     sets rc_force=YES.  This ignores argument_precmd
>                     returning non-zero, and ignores any of the required_*
>                     tests failing, and always returns a zero exit status.
> 
>              one    Skip the checks for rcvar being set to ``YES'', but
>                     performs all the other prerequisite tests.

In that case, someone should file a doc bug for the rc(8) manpage,
which says:

     Each script is expected to support at least the following arguments,
     which are automatically supported if it uses the run_rc_command() func-
     tion:

           start    Start the service.  This should check that the service is
                    to be started as specified by rc.conf(5).  Also checks if
                    the service is already running and refuses to start if it
                    is.  This latter check is not performed by standard
                    FreeBSD scripts if the system is starting directly to
                    multi-user mode, to speed up the boot process.  If
                    forcestart is given, ignore the rc.conf(5) check and start
                    anyway.

           stop     If the service is to be started as specified by
                    rc.conf(5), stop the service.  This should check that the
                    service is running and complain if it is not.  If
                    forcestop is given, ignore the rc.conf(5) check and
                    attempt to stop.

I don't have time to do it now, but will later if no one says they have....

  <mike


-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org


More information about the freebsd-hackers mailing list