Mats Kindahl wrote:
> Hi all!
>
> I've been looking around the net to see if I can find a solution, but to
> no avail, so I'm writing this in the hope that somebody can shed some
> light or point me in the right direction.
>
> I'm trying to write a SMF manifest for a DDNS client (inadyn), but for
> some reason, svc.startd fails to notice that the daemon has started, and
> I have no clue how to tell it which process it is or find out what is
> going wrong.
>
>   
So the daemon is already running? I'm guessing that it's the start 
script that's failing

echo "'$NAME' is already running"

since pgrep would return the running daemon's pid. Can you do ptree -c 
`pgrep inadyn` to see if the daemon is started by svc.startd? If the 
daemon is indeed running and not started by svc.startd, I'm guessing 
that killing the running daemon and restart it by 'svcadm clear inadyn' 
should work.

> Let's start with the failure I have:
>
> -bash-3.00$ svcs -xv inadyn
> svc:/network/ddns/client:inadyn (Dynamic DNS client)
>  State: maintenance since Mon Nov 13 12:07:39 2006
> Reason: Restarting too quickly.
>    See: http://sun.com/msg/SMF-8000-L5
>    See: man -M /usr/local/man -s 8 inadyn
>    See: /var/svc/log/network-ddns-client:inadyn.log
> Impact: This service is not running.
>
> and in the tail of the log, there is:
>
> -bash-3.00$ tail -20 /var/svc/log/network-ddns-client\:inadyn.log
> [ Nov 13 19:14:11 Executing start method
> ("/usr/local/lib/svc/method/inadyn-client start") ]
> 'inadyn' is already running
> [ Nov 13 19:14:12 Method "start" exited with status 0 ]
> [ Nov 13 19:14:12 Stopping because all processes in service exited. ]
> [ Nov 13 19:14:12 Executing stop method (:kill) ]
> [ Nov 13 19:14:13 Executing start method
> ("/usr/local/lib/svc/method/inadyn-client start") ]
> 'inadyn' is already running
> [ Nov 13 19:14:14 Method "start" exited with status 0 ]
> [ Nov 13 19:14:14 Stopping because service disabled. ]
> [ Nov 13 19:14:14 Executing stop method (:kill) ]
>
> The manifest is attached, but the start method is:
>
>       <exec_method type='method' name='start'
>                    exec='/usr/local/lib/svc/method/inadyn-client %m'
>                    timeout_seconds='300'>
>           <method_context>
>           <method_credential user="root" group="root"/>
>         </method_context>
>       </exec_method>
>
> which uses the inadyn-client script (that I wrote), containing the
> following lines (code edited):
>
> #!/sbin/sh
>
> . /lib/svc/share/smf_include.sh
>
> NAME=inadyn
> DAEMON=/usr/local/bin/$NAME
>     .
>     .
>     .
> case $1 in
>     start)
>         if [ ! -x $DAEMON ]; then
>             echo "$DAEMON is not executable, not starting"
>           exit $SMF_EXIT_ERR_CONFIG
>         fi
>         if [ ! -r $CONF ]; then
>             echo "$CONF not readable, not starting"
>           exit $SMF_EXIT_ERR_CONFIG
>         fi
>       if pgrep $NAME >/dev/null; then
>           echo "'$NAME' is already running"
>       else
>           $DAEMON &
>           sleep 1
>       fi
>         ;;
>           .
>           .
>           .
> esac
>
> exit $SMF_EXIT_OK
>
> When I call the 'inadyn-client' script directly, the daemon starts well
> and keeps going without a glitch, but when svc.startd tries to start it,
> it decides somehow that "all processes in the service exited". AFAICT,
> this is not the case.
>
>   
The daemon is running and the 'inadyn-client start' doesn't fail with 
"inadyn is already running"? Please provide the above information and 
hopefully things will be clearer.

-tony

> So, the questions are:
> - How do svc.startd decide if a process is in the service?
> - Is there a way to find out what is going wrong?
>
> Best wishes,
> Mats Kindahl
>   
> _______________________________________________
> smf-discuss mailing list
> smf-discuss at opensolaris.org
>   


Reply via email to