Christine Tran writes:
> Hi,
> 
> I have a script that runs all the time, basically, it's a
> 
> while true
> sleep
> do
>   check_something
>   do_something
> done
> 
> It runs fine. To be kosher I have written a manifest for it but its
> SMF state is never "online", it's always "offline" progressing to
> "online".
> I've reduced the timeout to 0.  I must be missing something obvious,
> like a stdout re-direct or something.  What's wrong and why won't SMF
> online it?
> 
> Also, there are exit conditions.  Since this is not a transient
> service, SMF will try to restart.  Can I get to a maintenance state
> with something like exit $SMF_EXIT_ERR_FATAL, and tweak the manifest
> to ignore signals, so SMF *never* restarts it even when all processes
> exited?  If SMF tries to restart, it will succeed, but this isn't what
> I want.
> 
> This stuff is too simple to write it as a real daemon, ie - a
> non-scripting low-level language.
> 
> CT
> _______________________________________________
> smf-discuss mailing list
> smf-discuss at opensolaris.org

The state won't be set to online until the start method exits with
SMF_EXIT_OK.  Thus, you probably need an intermediate script to fork off
your while true loop in a separate process.  The intermediate script can
then return SMF_EXIT_OK.  Declare the intermediate script as the start
method in your manifest.

If you set startd/duration to "transient" in your manifest, then I don't
think that startd will try to restart your service, because svc.startd(1M)
says svc.startd will not track processes for the service.

tom

Reply via email to