About running processes in background

Hi,

I need to establish a procedure that will start an application in background each time my remote Solaris server is (re)started. This would be a kind of daemon. I am no sysadmin expert, so I am looking for pointers.

How should I proceed? What are the main steps?

Thanks,

JVerstry

you should probably read about "init scripts" (if you are < solaris 10) or about "SMF" (solaris 10 or newer). a good startpoint is:

Sun Microsystems Documentation
and
Sun Microsystems - BigAdmin System Administration Portal

Thanks.

The 'uname -r' command tells me that my Solaris version is 5.11.

I have been doing some reading and it seems like I would have to put my script in the /etc/init.d/ directory or in a /etc/rc?.d directory (? = run level).

Is this correct? If yes, in which directory should I put my script (and with which run level)?

I have also read about a svcadm command available on Solaris 10 to enable services, but it does not exist in 5.11. Is there anything I should do to 'activate' my service/script in 5.11? Or does copying the script in the proper directory enough?

Thanks,

JVerstry

svcadm definitely exists with SunOS 5.11.

rc.d scripts are also still supported as an alternative.

If you are unsure about where to put your script, use run level 3 with a late run, eg:
/etc/rc3.d/S99myLocalService

Don"t forget to set stop scripts too:

/etc/rc0.d/K00myLocalService , /etc/rc2.d/K00myLocalService and /etc/rc3.d/K00myLocalService.

When I run svcadm, the command is not found. May be it has not been installed.

Just to make sure I understand you correctly:

i) /etc/rc3.d/S99myLocalService -> S99 means start late? In other words, Solaris would start this process after S98xxx files for example?

ii) You mention the creation of stop scripts. Do I have to create 3 scripts or is one in rc3.d enough?

iii) The stop script should contain a command stopping my service correct?

iv) If I use the /etc/rc?.d do I still need to activate my service with svcadm?

Thanks,

JVerstry

5.11 (opensolaris) is newer than solaris 10, so there should be the tools (make sure you are "root") for manage services. these are:

svcs, svcadm, svccfg, svcprop, ...

if you try to use a legacy script, you have to know where to put it, depending on the runlevel and the dependencies...

5.11 is newer than 10, I would never have guessed, lol !!!

svcs and svcprop do work, but svcadm and svcconf not (i.e., command not found). I have sent an email to the system administrator to get more info.

Thanks,

JVerstry

SunOS 5.11 is newer that SunOS 5.10, a.k.a. Solaris 10.

They just aren't in your PATH. /usr/sbin/svcadm and svcconf are mandatory parts of any SunOS 5.11 distribution.

Precisely. That's the way rc scripts are ordered.

The usual way is to create a single script that accept start and stop as single options and link them to the files I suggested. Have a look at scripts sitting in /etc/init.d for examples.

It must stop the service when passed the "stop" parameted.

No, these are alternative ways. The rc scripts are the legacy ones while SMF is the new way.

svcadm and svccfg are under /usr/sbin while svcs and svcprop are und /usr/bin. root should have both pathes in the $PATH variable...

Indeed this was a path issue. I can now access svcadm and svccfg properly. Thanks !