How to start a service controlled by SMF automatically when machine reboots
Hi all,
I installed solaris 10 on a machine. After that, I installed the SMC 3.6.1(Sun Management Center) on the machine.
Then I started all the SMC server services, but I did not start the SMC agent.
arthur:/var/svc/manifest/application/management <123> (root) # svcs -a | grep sunmc
online 11:36:14 svc:/application/management/sunmctrap:default
online 11:36:14 svc:/application/management/sunmccfgserver:default
disabled 11:36:14 svc:/application/management/sunmcplatform:default
online 11:36:14 svc:/application/management/sunmcevent:default
online 11:36:22 svc:/application/management/sunmcmetadata:default
disabled 11:36:36 svc:/application/management/sunmcagent:default
online 11:36:47 svc:/application/management/sunmcjavaserver:default
online 11:36:59 svc:/application/management/sunmcgrouping:default
online 11:37:05 svc:/application/management/sunmcdatabase:default
online 11:37:15 svc:/application/management/sunmcwebserver:default
online 11:37:24 svc:/application/management/sunmctopology:default
Then, I rebooted the machine with "init 6". After the machine was rebooted, the SMC server services were all restarted, but the SMC agent was not started.
It seems that SMF records the service's previous status before rebooting, and the SMF starts the services with the previous status "online", but it does not start the services with the previous status "disabled".
My question is that how to always start the service when reboot, regardless of its status before rebooting.
Thanks & regards,
Gavin Liu
[1653 byte] By [
Jie_Liua] at [2007-11-27 11:39:37]

# 1
Did you enable the service with:
svcadm enable application/management/sunmcagent
if you did and it still isn't starting look at the output from:
svcs -xv
# 2
Thanks for your reply.
My problem is not that I cannot use "svcs enable" to start the SMC agent.
My REAL problem is that I want the SMC agent can be automatically started when the machine is rebooted. I would not like to use "svcs enable" to manually start it.
The current problem is that:
If the SMC agent is enable before the machine is rebooted, the SMC agent is automatically started after the machine is rebooted.
If the SMC agent is disable before the machine is rebooted, the SMC agent will not be started after the machine is rebooted.
So what I really want to resolve is that: I want the SMC agent can be started automatically when the machine is rebooted regardless of its previous status. I don't want to use "svcs enable" to start it manually.
This is a genernal question not only applying to SMC, but also apply all the other services controlled by the SMF.
Thanks.
# 3
You can set the property of the manifest to 'enabled', this property will be read at boot and tell SMF that the service is enabled, but until boot it won't affect the manifest:
svccfg -s <instance_fmri> setprop general/enabled = true
You also have the -t switch to svcadm enable/disable, which causes an action not to be persistent across boots, if you would run
svcadm -t disable sendmail
sendmail will be disabled now and re-enabled at next boot.
.7/M.
# 4
Hi,
Thanks for your reply. I just tried your solution but it didn't work.
rome:/var/svc/manifest/application/management <106> (root) # svccfg -s application/management/sunmcagent general/enabled = boolean: true
rome:/var/svc/manifest/application/management <107> (root) # svccfg export application/management/sunmcagent > ./sunmcagent.xml
rome:/var/svc/manifest/application/management <108> (root) # svccfg import ./sunmcagent.xml
rome:/var/svc/manifest/application/management <109> (root) # svcprop application/management/sunmcagent
...
...
general/entity_stability astring Evolving
general/single_instance boolean true
general/enabled boolean true
...
...
rome:/var/svc/manifest/application/management <110> (root) # svcs -a | grep sunmc
disabled11:51:51 svc:/application/management/sunmcagent:default
disabled11:51:51 svc:/application/management/sunmcplatform:default
online 11:52:05 svc:/application/management/sunmccfgserver:default
online 11:52:05 svc:/application/management/sunmcevent:default
online 11:52:05 svc:/application/management/sunmctrap:default
online 11:52:09 svc:/application/management/sunmcmetadata:default
online 11:52:24 svc:/application/management/sunmcjavaserver:default
online 11:52:30 svc:/application/management/sunmcgrouping:default
online 11:52:35 svc:/application/management/sunmcdatabase:default
online 11:52:45 svc:/application/management/sunmctopology:default
online 11:52:53 svc:/application/management/sunmcwebserver:default
Then I rebooted the machine, but the sunmc agent was still in "disable" status. It was not "online" by SMF.
Could anybody provide help?
# 5
You have to set it after the import, if you export/import it, the change will be lost, try and disable the sunmcagent (if not already disabled), update the property with svccfg, verify the status of the service and then reboot.
.7/M.
# 6
I retried following your advice. This time I only modified the property by "svccfg" without export/import, and then rebooted. But it still doesn't work.
In addition, I added another property group "restarter" and set the restarter/state to online. But still cannot work.
rome:/ <108> (root) # svcprop -c application/management/sunmcagent
filesystem/entities fmri svc:/system/filesystem/local
filesystem/grouping astring require_all
filesystem/restart_on astring none
filesystem/type astring service
network/entities fmri svc:/network/initial
network/grouping astring require_all
network/restart_on astring none
network/type astring service
general/entity_stability astring Evolving
general/single_instance boolean true
general/enabled boolean true
restarter/state astring online
start/exec astring /lib/svc/method/es-svc.sh\ start\ agent
start/timeout_seconds count 300
start/type astring method
start/project astring :default
start/resource_pool astring :default
start/working_directory astring :default
stop/exec astring /lib/svc/method/es-svc.sh\ stop\ agent
stop/timeout_seconds count 100
stop/type astring method
stop/project astring :default
stop/resource_pool astring :default
stop/working_directory astring :default
tm_common_name/C ustring SunMC\ agent\ service
