David Powell wrote:
> Roland Mainz wrote:
> > - "usr/src/cmd/dlmgmtd/svc-dlmgmtd" contains something weired:
> > -- snip --
> > +# The real daemon is not started in a non-global zone. But we need to
> > +# create a dummy background process to preserve contract lifetime.
> > +
> > +if smf_is_nonglobalzone; then
> > + (while true ; do sleep 3600 ; done) &
> > + exit $SMF_EXIT_OK
> > +fi
> > -- snip --
> > Erm... questions:
> > 1. why is this done..
> > 2. ... and how should this work ? I assume the shell child process will
> > "meet the truck" at the first SIGHUP... or am I wrong in this case ?
> > 3. At which runlevel is this script used, before or after /usr has been
> > mounted ?
>
> A contract-duration service's start method is expected to exit having
> started some long-running daemon or set of daemons. If those
> processes ever die out, startd notices and restarts them.
>
> If a contract-duration service sometimes doesn't need to start long-
> running daemons, simply returning isn't an option. startd will think
> some calamity immediately befell the service and will immediately
> restart it. Eventually it will think something is seriously wrong
> and put the service in the maintenance state.
>
> This code is faking out SMF, making it think that the service is
> healthy (which it truly is) and running (which it really isn't).
> I notice svc-nscd plays a similar trick.
BTW: It's usually sufficient to do a $ sleep Inf+ # ("Inf+" positive
Infinite, causing the "sleep" builtin command to wait forever).
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O;)