Solaris SMF support
-------------------
see smf_security(5), svccfg(1M), svcs(1), svcadm(1M), svcprop(1)
http://opensolaris.org/os/project/smf-doc/smf-dev/smf-book.pdf
The advantage of using Solaris Service Management Facilities (SMF) is:
- the OS tracks dependencies and e.g. restart/stops all backends
automatically, if the spooler (on whome the backends depend on) gets
restarted/stopped. Also if one disables the spooler, the backends
are stopped as well automatically, since they depend on the spooler
service and vice versa.
- SMF takes care, that the services (spooler, backends) keep running.
If a service dies/coredumps, it gets automatically restarted by SMF
(often called self-healing).
- Since one is able to set the properties on each service indiviually,
there is no need to change the config.py back and forward all the
time. Also there should be no need to change the wrapper scripts
(backend/**/*.sh) and taht's why the whole ECSpooler can be made
readonly (ro), or imported as ro loopback filesystem into several
Solaris zones ...
- last but not least: SMF guarantees, that the services come up in the
right order and are started in the case of unattended reboots
Mini-Howto SMF:
---------------
Operate/modify the properties of a service like spooler or backend,
'solaris.smf.manage.ecs' authorization is required - see auths(1) . Per
default it is utilized for modify_authorization and action_authorization,
thus giving service operator the max. flexibility they need - so take care.
0) make sure, the content of the manifest is correct:
svccfg validate spooler.manifest
1) import the service:
svccfg import spooler.manifest
[2] modify properties:
svccfg -s spooler:default setprop options/port = integer: 5050
svccfg -s spooler:default setprop options/tmpdir = astring: "/tmp/ecs"
...
svcadm refresh spooler
[3] add add. env vars:
svccfg -s spooler setenv -m start MYVAR value
4) enable the service:
svcadm enable spooler
5) check, whether the service is running:
svcs -xv
[6] disable a service:
svcadm disable spooler
[7] remove a service:
svccfg delete spooler
For backends adjust a *.manifest and:
0) make sure ec_backends.method resides in /etc/svc/method/ and is r-x by root
if the directory does not exiost yet, create it
mdir -p /etc/svc/method/
cp ec_backends.method /etc/svc/method/ec-backend
chmod 0755 /etc/svc/method/ec-backend
1) copy a manifest of choice and adjust:
- instance name ($mybackend)
- BackendName in start and stop method
- options/port
- options/tmpdir
2) import the manifest
svccfg import $mybackend.manifest
3) enable the service:
svcadm enable backend/$mybackend
...
property values of the spooler:
------------------------------
List all values set: svccfg -s spooler:default listprop "options/*"
Modify a setting: svccfg -s spooler:default setprop options/logdir=/var/ecs
- make changes persistent: 'svcadm refresh options:refresh'
- restart the service to apply changes now: 'svcadm restart spooler:default'
(note: cause automatically restart of all enabled backends)
property values of a backend:
-----------------------------
List all values set:
svccfg -s :haskell listprop "options/*"
Modify a setting:
svccfg -s :haskell setprop options/logdir=/var/log/ecs
- make changes persistent: 'svcadm refresh :haskell'
- restart the service to apply changes now: 'svcadm restart :haskell'
Add env vars to the start method:
svccfg -s :haskell setprop \
'start/environment = astring: ("MY_HOME=/usr/local" "BAR=/usr/lib/foo")'
Del env vars from the start method:
svccfg -s :haskell setprop 'start/environment = ""'