I?m experiencing a problem with an SMF stop method on Solaris x86. The daemon 
in question is NTP. I am also experiencing the same issue with my SSH daemon 
but will use NTP for the purpose of this question. These are both scripts that 
I copied from my sparc implementation but I cannot figure out why SMF is having 
issue with the stop method since the script by itself stops the daemon just 
fine. I am by no means an expert with SMF or Solaris so forgive me for 
overlooking something simple. 

Executing "svcadm disable ntpd" puts it into maintenance mode.

Output from ?svcs ?x? is as follows:

bash-3.2# svcs -x ntpd
svc:/network/ntpd:default (NTPD)
 State: maintenance since Tue Jun 09 20:30:09 2009
Reason: Method failed repeatedly.
   See: http://sun.com/msg/SMF-8000-8Q
   See: /var/svc/log/network-ntpd:default.log
Impact: This service is not running.

I have checked the web page recommended above but it is not very helpful as to 
what the underlying cause could be. Processes related to ntpd and ntpddate are 
not running after the stop method is issued.

Clearing and enabling the service with svcadm starts the service without issue.

Logfile:
/var/svc/log/network-ntpd\:default.log
[ Jun  9 20:30:09 Stopping because service disabled. ]
[ Jun  9 20:30:09 Executing stop method ("/lib/svc/method/ntpd stop") ]
[ Jun  9 20:30:09 Method "stop" exited with status 208 ]
[ Jun  9 20:30:09 Executing stop method ("/lib/svc/method/ntpd stop") ]
[ Jun  9 20:30:09 Method "stop" exited with status 208 ]
[ Jun  9 20:30:09 Executing stop method ("/lib/svc/method/ntpd stop") ]
[ Jun  9 20:30:09 Method "stop" exited with status 208 ]
[ Jun  9 20:32:13 Leaving maintenance because clear requested. ]
[ Jun  9 20:32:13 Enabled. ]

svcs ?l produces:
bash-3.2# svcs -l ntpd
fmri         svc:/network/ntpd:default
name         NTPD
enabled      false
state        maintenance
next_state   none
state_time   Tue Jun 09 21:03:52 2009
logfile      /var/svc/log/network-ntpd:default.log
restarter    svc:/system/svc/restarter:default
contract_id  263
dependency   require_all/none svc:/system/filesystem/local (online)
dependency   require_all/none svc:/network/loopback (online)
dependency   require_all/none svc:/network/physical (online)
dependency   require_all/restart file://localhost//usr/local/etc/ntpd.conf 
(online)
dependency   require_all/none svc:/milestone/network:default (online)

The method script:

#
# Start/stop NTPD
#
. /lib/svc/share/smf_include.sh
stop_ntpd()
{
        /usr/bin/pkill ntpddate
        /usr/bin/pkill ntpd
}
case "$1" in
'start')
        if [ -x /usr/local/bin/ntpd -a -f /usr/local/etc/ntpd.conf ] ; then
                if [ -x /usr/local/bin/ntpdate ] ; then
                        /usr/local/bin/ntpdate timehost  ; sleep 2
                fi
                /usr/local/bin/ntpd -c /usr/local/etc/ntpd.conf &
        fi
        ;;
'stop')
        stop_ntpd
        ;;
*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit $SMF_EXIT_OK

The manifest:

The tags of xml file are not displayed correctly through the forum interface. 
If someone absolutely needs them I can figure out a way to post it.

Thanks
-- 
This message posted from opensolaris.org

Reply via email to