svcbundle extended

svcbundle is an really useful tool to create SMF manifestes without having to hassle too much with XML. Most often you don’t have to work with XML at all , but there were some gaps where you wasn’t able to use some options that SMF offers with non-edited manifest generated by svcbundle because the -s option simply did not support this parameter. svcbundle was simply never thought as full subsitite for vi and some knowledge to every thinkable usecase of a SMF manifest.

Solaris 11 SRU 27 closed some of the gaps. You can now define a jitter and delay for an periodic service. I will write a blog entry about those options later.

However you can now define a timeout value for the methods. This blog entry is about this addition. Per default it would use a timeout of 60 second, but with the -s timeout= you can set it for all methods to a value of your preference. When using -s timeout the timeout is the same for all methods. This was one of the parts which i most often edited manually after working with svcbundle. The other one will be addressed by a blog entry in a few days.

# svcbundle -s service-name=site/narf \
 -s start-method="/lib/svc/method/narf %m" \
 -s stop-method="/lib/svc/method/narf %m" \
 -s refresh-method="/lib/svc/method/narf %m" \ 
 -s model=daemon -s timeout=30
 [...]
        <exec_method name="start" type="method" timeout_seconds="30"
            exec="/lib/svc/method/narf %m"/>
        <exec_method name="stop" type="method" timeout_seconds="30"
            exec="/lib/svc/method/narf %m"/>
        <exec_method name="refresh" type="method" timeout_seconds="30"
            exec="/lib/svc/method/narf %m"/>

However sometimes you just want to set a certain timeout for one of your methods, for example because the start script takes longer, you want a timeout longer than the refresh timout which may be just a SIGHUP to a process. You can now specify method specific timeouts via svcbundle via -s start-timeout=, -s stop-timeout= and -s refresh-timeout=

# svcbundle -s service-name=site/narf \
 -s start-method="/lib/svc/method/narf %m" \
 -s stop-method="/lib/svc/method/narf %m" \
 -s refresh-method="/lib/svc/method/narf %m"  \ 
 -s model=daemon \
 -s start-timeout=30 -s stop-timeout=20 -s refresh-timeout=10
[...]
        <exec_method name="start" type="method" timeout_seconds="30"
            exec="/lib/svc/method/narf %m"/>
        <exec_method name="stop" type="method" timeout_seconds="20"
            exec="/lib/svc/method/narf %m"/>
        <exec_method name="refresh" type="method" timeout_seconds="10"
            exec="/lib/svc/method/narf %m"/>