On 2012/03/29 17:36, MERIGHI Marcus wrote:
> Hello,
>
> 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).
> 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?
> 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.
> 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?
> type rc_post >/dev/null && rc_post || return 0
> }
>
> rc_cmd $1
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> downside: longer, uglier.
>
> bye, Marcus
>