How to auto start a service on rebooting a Solaris 5.10 x86 machine?

Hi all,

How to auto start a snmpd deamon on rebooting a Solaris 5.10 x86 machine.

snmpd's path: /opt/download/net-snmp/sbin

Thank you in advance.

With Solaris 10, you'll need to create an SMF manifest, import it via svccfg import , and administer the service via svcadm . Whilst legacy "init" scripts are still supported, you should definitely be using SMF where possible.

Understanding SMF is beyond the scope of a forum post, so I'd suggest reading the appropriate documentation on the Oracle site for further information.

Hi zazzybob,

Thank you for your reply.

Please let me know how to add to "init" script.

Thank you in advance.

Hi,

Create an appropriate script under /etc/init.d (accepting at minimum start and stop arguments) and then create the appropriate S* and K* links under the runlevel directories you wish the service to start (and stop) in. Most default Solaris 10 services that still use init scripts use hard links, e.g.

# ls -li /etc/rc2.d/S98deallocate /etc/init.d/deallocate
      1852 -rwxr--r--   2 root     sys          733 Jun 29  2011 /etc/init.d/deallocate
      1852 -rwxr--r--   2 root     sys          733 Jun 29  2011 /etc/rc2.d/S98deallocate

Have a look at some of the existing scripts under /etc/init.d to understand how they need to be written.

This may seem like the easy option - but I strongly recommend getting to grips with SMF.

Cheers,
ZB

Hi,

Thank you for your quick reply.

I did it comply with your request. I will study SMF function.

Thank you in advance.

Just write an init script. It's simple, understandable, and even more important easily maintainable for someone in the future.

SMF services are none of that.

SMF services are great when you have complex dependencies between various services and events. But just because you have a hammer doesn't make every problem a nail.

1 Like

Sun and now Oracle have insisted that init scripts are "legacy" and will be removed in a later Solaris release. Also, they no longer guarantee the order in which they'll be started or stopped, as the init scripts are themselves executed by an SMF service.

So - you should be using SMF, even for simple things. It's the way Solaris has evolved and is evolving. It's not hard to write an SMF manifest for a simple service once you've read the documentation.