1#!/bin/sh 2 3killproc() { # kill named processes 4 pid=`/usr/bin/ps -e | 5 /usr/bin/grep $1 | 6 /usr/bin/sed -e 's/^ *//' -e 's/ .*//'` 7 [ "$pid" != "" ] && kill $pid 8} 9 10case "$1" in 11'start') 12 ps -e | grep xntpd > /dev/null 2>&1 13 if [ $? -eq 0 ] 14 then 15 echo "ntp daemon already running. ntp start aborted" 16 exit 0 17 fi 18 if [ -f /etc/inet/ntp.conf -a -x /usr/sbin/xntpd ] 19 then 20 /usr/sbin/xntpd -c /etc/inet/ntp.conf 21 fi 22 ;; 23'stop') 24 killproc xntpd 25 ;; 26*) 27 echo "Usage: /etc/init.d/xntp { start | stop }" 28 ;; 29esac 30