Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've created a service for an application, and I want this application to be started on boot. In the service manifest, I realize that there's a property for this (enabled="true"), but I've been avoiding this for a particularly annoying aspect:

The import is part of a script. Having the service as "enabled" means that it will be restarted on import. The problem is that I'm not sure how to wait until the process is enabled before continuing. So, what I do in the script is import with enabled set as "false", then run "svcadm enable -s <service>".

So I was wondering if anyone had any answers for any one of these questions:

  1. How do you make an existing service start on boot (hopefully avoiding manual additions to rc3.d)?
  2. How do you make svccfg import wait until a service is completely enabled before continuing?
  3. Is there an elegant way to wait until a service is started before continuing (avoiding manually grepping for enabled in a loop)?

Thanks.

share|improve this question
    
Can you clarify question 2? I've created several services enabled by default and it seems to work fine. –  bahamat Jun 14 '12 at 20:46

2 Answers 2

up vote 0 down vote accepted

I'll try to answer your questions about Solaris SMF ...

  1. To start a service at boot time, you simple must enabled the service with

    # svcadm enable FRMI
    

    For example, to enabled the service "ipfilter" you need to make

    # svcadm enable ipfilter
    

    This will be enable on the current milestone, so, there is no need to make any changes on /etc/rcX.d directory

  2. I don't understand why you need the import process to wait to some other frmi, but, i usually import the "manifest" and after that put online with svcadm, for example

    # svccfg validate MANIFEST
    # svcadm enable FRMI
    
  3. To wait other frmi you can use the "dependency" option inside the manifest, as you can see here

    <dependency
        name='filesystem-local'
        grouping='require_all'
        restart_on='none'
        type='service'>
        <service_fmri value='svc:/system/filesystem/local:default' />
    </dependency>
    

I have many examples about how to install and use the Solaris SMF in my Blog (in Spanish) but, for example, here you can see a example, How to Install PostgreSQL 9.0.3 on OpenIndiana or How to Install Apache Tomcat using RBAC and SMF on OpenIndiana

share|improve this answer

Perhaps can you solve this by making your service dependent of another service not yet enabled.

share|improve this answer
    
Thanks for the suggestion. Unfortunately, I'm not really comfortable with this particular workaround. I really appreciate the answer though. –  noisesolo May 31 '11 at 18:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.