>On 9/11/06, Fu Zhi-jun <Zhijun.Fu at sun.com> wrote: >> Hi,all, >> >> Recently I met a problem in using smf. >> I used "svccfg -s ${FMRI} setprop config/$SERVICE_ENABLED = true" to >> enable a service,and then used "svcprop -p config/$SERVICE_ENABLED >> $FMRI" to retrieve the value to judge whether the service is enabled. To >> my surprise, svcprop told me the service is 'disabled'. >> Later, I learned from others that svccfg operates on 'current' set, and >> svcprop retrieves value from 'running" snapshot, so I need to use >> "svcadm refresh $FMRI" to copy the value to running set, or use '-c' to >> let svcprop retrieve value from 'current' set. >> >> Then my question is, why we need the running snapshot? Isn't it easier >> to use only the current set other than syncing between the two sets? > >At least for scripting, it will be disruptive to the service if SMF >syncs for every in-transit svccfg invocations.
There are several other reasons: - the requirement of doing "svcadm refresh" after modifying properties allow you to reconfigure the services without worrying about the system behaving strangely when only a part of the properties have been updated - the "current" repository keep tracks of services coming on-line; in general the on-disk repository does not need to be written when booting - the "current" repository allows for temporary disabling of services (disable until next reboot) Casper