[csw-maintainers] tip on smf services, and conditional start
Philip Brown
phil at bolthole.com
Tue Sep 21 23:12:24 CEST 2010
I've just discovered something that, if true, may be very useful to
us, for SMF based services.
Background:
There are certain demons that may or may not be chosen to be enabled,
at install time.
Right now, we go through assorted backflips to respect things like
"autoenable_demons=no", and the like, attempting to use svcadm/svccfg
enable/disable at install time.
However, there seems to be another alternative.
IF the demon expects a config file, and IF that config file needs to
be hand-crafted by the user before being useful; It seems we can add
special magic into the xml manifest, where IF the config file exists,
then SMF will start the service. but if not, then the service wont
start. Without any errors being flagged.
I came across this while examining the sun ssh SMF definitions.
I think that if if /etc/ssh/sshd_config is not present entirely, then
it just leaves the service in an offline state.
Even directly attempting to online it, leaves it offline, until the
config file is created.
The magic xml to include, would seem to be:
<dependency name='config_data'
grouping='require_all'
restart_on='restart'
type='path'>
<service_fmri
value='file://localhost/etc/ssh/sshd_config' />
</dependency>
I'm not an XML or smf guru, so this sort of thing should be tested
carefully before deploying. But I thought I'd share this potentially
useful trick, in case anyone is motivated to take it further.
More information about the maintainers
mailing list