Get Java Version
Get Java Version
Note that enable and disable are persistent. If you enable a service it will be brought back up after a
reboot. Similarly with disabling.
If you want to stop a service but have it come back up after the next reboot, use
Solaris 10 still pays attention to /etc/rcN.d, but services defined there are "legacy", and can't be fully
monitored and controlled.
To define a service, you create an XML file that specifies dependencies, and methods to start and
stop it.
Normally the XML file is written to create an instance but not enable it. So if the import works, you
would need to do "svcadm enable SERVICE" to start it.
A good way to start writing the XML file is to look at existing ones. They are in subdirectories of
/var/svc/manifest.
If you add services, you probably want to put your .xml files in /var/svc/manifest and your scripts in
/lib/svc/method. That way anyone who needs to work with the system can find them, just as they
now know to look in /etc/init.d for all startup scripts. However I suggest making those symbolic links
to files that are actually in /usr/local/svc/manifest and /usr/local/svc/method. That way you won't
lose your information in a system reinstallation.
Note that if all processes started by a service die, the system will try to restart the service by doing a
stop and then a start.
You can also define a "refresh" action, which prods a service if a configuration file changes.
You'll always need an XML header. Comments can be added in normal XML fashion.
<?xml version="1.0"?>
<service
name='network/myserver'
type='service'
version='1'>
---------------------------------------------------------------------
an incompatibility.
common.
<dependency name='loopback'
grouping='require_all'
restart_on='error'
type='service'>
<service_fmri value='svc:/network/loopback:default'/>
</dependency>
-> "optional_all" : Listed FMRIs are either online or unable to come online, either
to deps.
Restart_on => Type of event from the FMRI that this service should be restarted for, being:
-> refresh : Restarted if the dep is restarted or refreshed for any reason.
-> none : Nothing, never start the service to to a dep state change.
<service_fmri value='svc:/network/loopback:default'/>
Define your methods, normally one each for "start", "stop", and "refresh".
<exec_method
type='method'
name='start'
exec='/usr/bin/serverd'
timeout_seconds='60' />
delete => If in the repo, the property group for this method should be remoed.
<restarter>
</restarter>
Method contexts can be handy to setup the enviroment (or "context") in which your service runs.
<method_context>
<method_environment>
</method_environment>
</method_context>
-> group
-> supp_groups
-> privileges
-> limit_privileges
</property_group>
Should it start by default?
<single_instance />
There you go, some of my chopped up notes that might be handy. Mind you, this isn't official, just my
scribbled notes that I thought might be helpful to someone or at least get ya fired up enought to
dabble into SMF for yourself. If anyone finds this terribly useful I'll form it into a pretty LaTeX
document at some point.