Background and forking process from SMF

Hello all,

this might be a stupid question, but i haven't find any clear answer, possibly since its difficult to find any good keywords to feed into a searchengine.

I started to write manifests for the local processes that i'm running on my server, however i got into some problems with certain applications that doesn't fork themself into the background properly.

Some examples are mysql, kerberos (i'm using a heimdal kerberos) and some other small applications.

In an old rc script i'ld simply start them by typing

/usr/local/sbin/foo &

or if i'm ambitious:

/usr/local/sbin/foo > /some/logfile 2>&1 &

but if i tries to start the application from a manifest like this:

[...]

<exec_method

type='method'

name='start'

exec='/usr/local/sbin/foo '

timeout_seconds='60' >

</exec_method>

[...]

.. the SMF will kill the process after the timeout since it didn't detach itself, adding a & to it simply wont work since its unparsable by the import.

Are there any solution to this? It seems wrong to create a shell script which just runs

/usr/local/sbin/foo &

.. when there should be a way to do this directly in SMF (at least IMHO).

Any ideas :-)?

.7/M.

[1444 byte] By [mAbrante] at [2007-11-26 10:42:39]
# 1
Good question. I had never considered that this wasn't easy to do in the manifest (or that & was an illegal character).I might suggest asking on the OpenSolaris SMF discussion board if no one here has an answer quickly.-- Darren
Darren_Dunham at 2007-7-7 2:54:33 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 2
Try using "&amp;" instead of "&".
David_Bustos at 2007-7-7 2:54:33 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 3

Interesting. Is this mentioned somewhere among the myriad documents that I haven't read yet? :-)(or is it just basic XML syntax or something...)

(and is this really how you're supposed to launch processes that don't daemonize? I don't see any examples of similar processes among the Sun manifests)

--

Darren

Darren_Dunham at 2007-7-7 2:54:33 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 4
The ampersand syntax is basic XML.Technically, no: your method should only return when your daemon is ready to serverequests. But this should work if your daemon always starts properly.
David_Bustos at 2007-7-7 2:54:33 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 5

Hey, that worked.

mybox(~):# grep kpasswd /var/svc/manifest/local/test.xml

<instance name='kpasswdd' enabled='false' >

exec='/usr/local/sbin/kpasswdd &'

mybox(~):# grep kpasswd /var/svc/log/local-test\:kpasswdd.log

[ Oct 12 09:49:35 Executing start method ("/usr/local/sbin/kpasswdd &") ]

mybox(~):#

thanks!

.7/M.

mAbrante at 2007-7-7 2:54:33 > top of Java-index,Solaris Operating System,Solaris 10 Features...