Thursday, 30 June 2011

Sun Solaris 10 X86 assistance management facility overview

Sun Solaris 10 is Very different from old versions of the operating system. It makes use of its new aid supervision Facility. This software runs all processes and helps to operate them and their dependencies as well as whether or not they need to be started when the server starts.

The main two commands you need to remember are svcadm and svcs

Solaris 10

Svcs
This is used to display what processes and software are in online, offline, and maintenance mode. This can be helpful if you are trying to troubleshoot something and you are noticing things not working quite right. For example, if you are installing apache for the first time and your web server is not displaying. A quick check to find apache in maintenance mode would quote you have some question with your configuration.

To display all currently enabled and disabled services type either:
# svcs
or
# svcs -a

Svcadm
This is the tool you use to administrate your processes and applications. You can do many things with this tool. The nicest highlight of it compared to the old method of using init.d or rc directory start files is that svcadm is much smarter. If your application requires a dependency to run it won't just giveup leaving you confused, it will go and start up the dependencies for you and then start up the application you are trying to start.

Some sample ways to use the Smf (Service supervision Facility)

Enable a Service:
# svcadm enable -rs mysql

This will enable mysql to run. After you enable a service, run svcs to see if its running.

svcs usually displays all things so just try typing:
# svcs | grep mysql

If it's in online state then you are good to go, it has started successfully.

Disable a Service:
# svcadm disable - s mysql

The enable and disable tags have options you can use with them. For example
# svcadm enable -rst mysql

The r flag tells svcadm to start mysql recursively. So it will recursively start all of mysql's dependencies. The -s selection is specified it will start each aid instance and waits for each services to start and have a online status state. The -t selection tells svcadm to just start mysql temporarily. So upon the next reboot, mysql will not be auto started. If you wish to mysql to always start when the server reboots, you should leave the t selection off so that it sets it constantly enabled. The same goes for the disable tag, however disable does not use the r option, only -s and -t.

Restart a service:
# svcadm restart servicename

For example:
How to restart networking:
svcadm restart network/physical

Svcadm Manifest Files
The Smf law uses manifest files to start up sure services. It is similar to the init.d files I guess you could say. These files are usually located in the following directory:
/var/svc/manifest/
or
/opt/csw/lib/svc/method

Manifest files are usually.xml files. Have a look at them in that directory to see what they are doing. When you call the svcadm enable servicename, it is calling these files to do the actions for you.

svccfg
If you create custom manifest files for your services you will need to create them to the specs that Smf uses as well as validate and import them into the Solaris 10 Smf repository. You can do this by using svccfg. For example:

# svccfg validate /var/svc/manifest/application/database/mysql.xml
# svccfg import /var/svc/manifest/application/database/mysql.xml

Error Logs
To see if something is wrong when you try to originate a application through the Svc law you can check the error logs for this in:
/var/svc/log/

Sun Solaris 10 X86 assistance management facility overview

No comments: