Service Management Facility (SMF) - Service Won't Go Online

Hello All,

I am new to this forum, but getting rather frustrated and thought I'd see if any of you could point me in the right direction.

I have just loaded Solaris 10 on my local workstation and I'm trying to get it set up. I have a simple script that I did have set up in my Solaris 9 inittab file to respawn. This script essentially kept track of my filesystem size and sent me an email if any specified filesystem went over a defined limit.It worked great for me in my Sol9 environment.

I have been trying to create a service (manifest?) for this same script, and I am clearly doing something wrong because when I import/enable the xml file, the service runs (I can see the process consistantly running, exiting, restarting), but the service state is offline.

I confess, this is my first attempt at a service script...and I can't seem to find much on-line info about the values - I have essentially just copied bits and pieces from other service xml files.

Please take a look and let me know if you see anything obviously wrong.

# svccfg import fscheck.xml

# svcs -a |grep fscheck

offline*12:53:25 svc:/site/fscheck:default

# svcs -xv fscheck

svc:/site/fscheck:default (?)

State: offline since Tue Jul 24 12:53:25 2007

Reason: Start method is running.

See: http://sun.com/msg/SMF-8000-C4

See: /var/svc/log/site-fscheck:default.log

Impact: This service is not running.

# ps -ef |grep fscheck

root 31848180 11:12:01 pts/40:00 tail -f site-fscheck:default.log

root 348470 13:08:26 ?0:00 /bin/ksh /lib/svc/method/fscheck

Output of log file.

[ Jul 24 12:56:25 Method "start" exited with status 0 ]

[ Jul 24 12:56:25 Stopping because all processes in service exited. ]

[ Jul 24 12:56:25 Executing stop method (null) ]

[ Jul 24 12:56:25 Executing start method ("/lib/svc/method/fscheck") ]

# svcs -l fscheck

fmri svc:/site/fscheck:default

enabledtrue

stateoffline

next_stateonline

state_timeTue Jul 24 13:08:26 2007

logfile/var/svc/log/site-fscheck:default.log

restartersvc:/system/svc/restarter:default

contract_id 214

dependencyrequire_all/none svc:/milestone/multi-user-server (online)

# more fscheck.xml

<?xml version="1.0"?>

<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">

<service_bundle type='manifest' name='manifest:fscheck'>

<service

name='site/fscheck'

type='service'

version='1'>

<create_default_instance enabled='true' />

<single_instance />

<dependency

name='foo_opt'

type='service'

grouping='require_all'

restart_on='none'>

<service_fmri value='svc:/milestone/multi-user-server' />

</dependency>

<exec_method

type='method'

name='start'

exec='/lib/svc/method/fscheck'

timeout_seconds='0' >

</exec_method>

<exec_method

type='method'

name='stop'

exec=':true'

timeout_seconds='0' >

</exec_method>

<property_group name='startd' type='framework'>

<propval name='duration' type='astring' value='wait' />

</property_group>

<stability value='Unstable' />

</service>

</service_bundle>

[3444 byte] By [calmgreena] at [2007-11-27 11:35:40]
# 1

It looks like your startup script is hanging somehow. Run a ps and grep the process of the startup script to see if it has any children. That may help you determine where it is getting stuck. If you can't find any children, edit that script and add checkmarks that write to a debug file. Things like:

echo "checkpoint 1: `date` " >> /tmp/fscheck

Or... now that I think about it.... did you simply put your script in place at:

/lib/svc/method/fscheck ?

If so, that's your problem. SVC expects the startup script to finish, and from there tracks the children.

Put fscheck somewhere else, and make /lib/svc/method/fscheck a script that calls your fscheck as a background process.

swilson-uca at 2007-7-29 17:04:12 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 2

Dear swilson,

That did it! I didn't realize that the SVC worked that way.

I moved the script to another dir and just created a quick and dirty script under the method dir calling that script and asking it to run in the background.....I killed the existing process...and it restarted....I ran the svcs -a |grep fscheck command.

...and it came up online.

Thank you so much!....granted the past several days of struggling with this has taught me a lot about the various commands, but I was just about to give up on it all. Again, Thank you.

'chele

calmgreena at 2007-7-29 17:04:12 > top of Java-index,Solaris Operating System,Solaris 10 Features...