summaryrefslogtreecommitdiffstats
path: root/abs/core/ntp/ntpd
diff options
context:
space:
mode:
authorCecil <knoppmyth@gmail.com>2011-07-06 08:08:54 (GMT)
committerCecil <knoppmyth@gmail.com>2011-07-06 08:08:54 (GMT)
commitbf21b389e5f4e90aa8d16f953fafc04d53b729fe (patch)
tree6bb8154fffb0a9494e5327f0374bcb7f0fb9e7f2 /abs/core/ntp/ntpd
parent965b69db0623e1b510715bfa8ba081d857437e21 (diff)
downloadlinhes_pkgbuild-bf21b389e5f4e90aa8d16f953fafc04d53b729fe.zip
linhes_pkgbuild-bf21b389e5f4e90aa8d16f953fafc04d53b729fe.tar.gz
linhes_pkgbuild-bf21b389e5f4e90aa8d16f953fafc04d53b729fe.tar.bz2
ntp:bumped to latest.
Diffstat (limited to 'abs/core/ntp/ntpd')
-rwxr-xr-xabs/core/ntp/ntpd40
1 files changed, 26 insertions, 14 deletions
diff --git a/abs/core/ntp/ntpd b/abs/core/ntp/ntpd
index 56f6248..825efc1 100755
--- a/abs/core/ntp/ntpd
+++ b/abs/core/ntp/ntpd
@@ -4,30 +4,42 @@
. /etc/rc.d/functions
. /etc/conf.d/ntp-client.conf
-PID=`pidof -o %PPID /usr/bin/ntpd`
+PIDFILE="/var/run/ntpd/ntpd.pid"
+PID=$(cat $PIDFILE 2> /dev/null)
+
case "$1" in
start)
stat_busy "Starting NTP Daemon"
+ [ ! -d /var/run/ntpd ] && install -d /var/run/ntpd &>/dev/null
if [ -z "$PID" ]; then
- /usr/bin/ntpd $NTPD_ARGS &
- fi
- if [ ! -z "$PID" -o $? -gt 0 ]; then
- stat_fail
+ /usr/bin/ntpd $NTPD_ARGS -p /var/run/ntpd/ntpd.pid &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon ntpd
+ stat_done
+ fi
else
- PID=`pidof -o %PPID /usr/bin/ntpd`
- echo $PID > /var/run/ntpd.pid
- add_daemon ntpd
- stat_done
+ stat_fail
+ exit 1
fi
;;
stop)
stat_busy "Stopping NTP Daemon"
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
+ if [ -n "$PID" ]; then
+ kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm $PIDFILE &>/dev/null
+ rm_daemon ntpd
+ stat_done
+ fi
else
- rm_daemon ntpd
- stat_done
+ stat_fail
+ exit 1
fi
;;
restart)