On Wed, Jul 2, 2008 at 7:46 PM, Jordan Brown <Jordan.Brown at sun.com> wrote:
> As I think I mentioned, I need a run-once mechanism.
>
> As it worked out, the mechanism was not far from being pretty general. Take
> a look...
>
> The only part of it that is visible to the application that wants the "run
> once" service is application-xvm-first-boot.xml.  When an application wants
> something run once, it creates a manifest like that. Everything in it is
> boilerplate except for the instance-name (which must be unique) and the
> value of $RUN, which specifies the command to execute.  (The
> boilerplate-to-meat ratio is unfortunate, but better than it might be.)
>
> runonce.xml is the framework of the service.  There's not a lot more there,
> but there's a bit.
>
> runonce is the script that does the dirty work.  It runs the target program.
>  If the target command succeeds, runonce disables the instance.  If the
> target command fails then it records the failure and takes the instance into
> "maintenance".
>
> Note that runonce could be changed to delete the instance, or whatever.
>
> Any thoughts?

Sometimes a runonce service needs to trigger a reboot.  It looks to me
as though all runonce services will be running at the same time -
making such a thing somewhat risky.  Is this something that you are
intending to support?

> #! /bin/sh
> #
> # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
> # Use is subject to license terms.
> #
>
> # runonce
> # Runs command specified as instance name.
> # If it fails, returns SMF failure.
> # If it succeeds, disables this SMF service and returns success.
>
> . /lib/svc/share/smf_include.sh
>
> sh -c "$RUN"

One of the things that I commonly need to run on first boot is an ELF
executable.  Is there a reason to force a Bourne shell wrapper?  As
currently implemented it could cause confusion for software targeting
OpenSolaris and Solaris because /bin/sh in OpenSolaris 2008.05 is
really ksh93.  This would mean that a Korn shell script tested on
OpenSolaris will work just fine but will fail on Solaris 10.

Overall I am enthusiastic about having something like this available.
It is a common need and ad-hoc implementations tend to be too much
effort to implement reliably.

-- 
Mike Gerdts
http://mgerdts.blogspot.com/

Reply via email to