Hello Stuart, 

[email protected] (Stuart Henderson), 2012.03.29 (Thu) 18:26 (CEST):
> On 2012/03/29 17:36, MERIGHI Marcus wrote:
> > stock rc.d script:
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > #!/bin/sh
> > #
> > # $OpenBSD: svscan.rc,v 1.1 2012/01/01 16:16:24 sthen Exp $
> > 
> > daemon="/usr/local/bin/svscan"
> > daemon_flags="/service/"
> > 
> > . /etc/rc.d/rc.subr
> > 
> > rc_bg=YES
> > rc_reload=NO
> > 
> > rc_cmd $1
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > downside: freedt is a super-server, this script does not stop the real
> > services, nor the supervisor (supervise), just svscan.
> 
> It might make some sense to do something like this.
> > And it forces the ``service'' directory to be under ``/''.
> Not correct, you missed the ENVIRONMENT section in rc.d(8).

Sure you are right once more, starting to hate that ;-)

> > rc_start() {
> >     type rc_pre >/dev/null && rc_pre
> >     ${rcexec} "/bin/csh -cf \"env PATH=${PATH}:/usr/local/bin/ \
> >         /usr/local/bin/svscan ${freedt_flags} &\""  > /dev/null
> Why?

Actually I do not remember; the ``type rc_pre'' thing is surely just
stolen from rc.subr; the csh stuff most likely comes from using the
original djb daemontools some time ago. And I'm not sure ``rc_bg=YES''
already existed when I wrote my script. 

> > rc_reload() {
> >     /usr/local/bin/svc -h ${freedt_flags}/*
> >     /usr/local/bin/svc -h ${freedt_flags}/*/log
> > }
> 
> We can't assume that the daemons run under supervise will reload
> config on a HUP signal, some might just exit/restart. So this should
> not be included and rc_reload=NO should stay.

+1 (should I think more before I hit send?)

> > rc_stop() {
> >     pkill -f "^${pexp}"
> >         sleep 1
> >     /usr/local/bin/svc -d ${freedt_flags}/*
> >     /usr/local/bin/svc -d ${freedt_flags}/*/log
> >     sleep 1
> >     /usr/local/bin/svc -t ${freedt_flags}/*
> >     /usr/local/bin/svc -t ${freedt_flags}/*/log
> >     sleep 1
> >     /usr/local/bin/svc -X ${freedt_flags}/*
> >     /usr/local/bin/svc -X ${freedt_flags}/*/log
> >     sleep 1
> >     pkill -f "^supervise .*"
> 
> svc -X should be enough, surely?
 
Couldn't tell; depends on what ``Bring service down, then end
supervise'' means. If it means "svc -d" then I would keep -t (and even
-k), to make sure they're gone.

So, the remains are:

rc_stop() {
        pkill -f "^${pexp}"
        sleep 1
        /usr/local/bin/svc -X ${freedt_flags}/*
        /usr/local/bin/svc -X ${freedt_flags}/*/log
}

That is indeed more elegant to add and should suffice, according to the
scarce docs.

What about the name, though? Is ``svscan'' still appropriate?

bye, Marcus

Reply via email to