diff options
author | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2012-01-03 11:39:36 -0300 |
---|---|---|
committer | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2012-01-03 11:39:36 -0300 |
commit | ca2e05bb7791418f2af678704160d56d8184a21a (patch) | |
tree | 48a6f85c00b3ed2362cc4d9c9d7f5230bb854eba /extra/ntp/ntpd | |
parent | 45675ec8babcd9ea73f6a49f51f6e7da9d1f1592 (diff) | |
parent | 48c96871761a4aad193d814e87ddb87c322e17d2 (diff) |
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts:
community-staging/libgda3/PKGBUILD
community/intel-tbb/PKGBUILD
community/mtpaint/PKGBUILD
extra/cmake/PKGBUILD
extra/graphicsmagick/PKGBUILD
extra/kdeadmin/PKGBUILD
extra/kdelibs/PKGBUILD
extra/lyx/PKGBUILD
extra/qtscriptgenerator/PKGBUILD
kde-unstable/kdeadmin/PKGBUILD
kde-unstable/kdelibs/PKGBUILD
kde-unstable/kdeplasma-addons/PKGBUILD
libre/libretools/PKGBUILD
libre/p7zip-libre/PKGBUILD
multilib-testing/lib32-glibc/PKGBUILD
multilib/wine/PKGBUILD
testing/glibc/PKGBUILD
Diffstat (limited to 'extra/ntp/ntpd')
-rwxr-xr-x | extra/ntp/ntpd | 81 |
1 files changed, 38 insertions, 43 deletions
diff --git a/extra/ntp/ntpd b/extra/ntp/ntpd index a3e886e1f..480fa1088 100755 --- a/extra/ntp/ntpd +++ b/extra/ntp/ntpd @@ -4,49 +4,44 @@ . /etc/rc.d/functions . /etc/conf.d/ntpd.conf -PIDFILE="/var/run/ntpd/ntpd.pid" -PID=$(cat $PIDFILE 2> /dev/null) +unset PID +PIDFILE='/run/ntpd.pid' + +if [[ -r ${PIDFILE} ]]; then + read -r PID <"${PIDFILE}" + if [[ -n ${PID} && ! -d /proc/${PID} ]]; then + rm -f "${PIDFILE}" + unset PID + fi +fi 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 -p /var/run/ntpd/ntpd.pid &>/dev/null - if [ $? -gt 0 ]; then - stat_fail - exit 1 - else - add_daemon ntpd - stat_done - fi - else - stat_fail - exit 1 - fi - ;; - stop) - stat_busy "Stopping NTP Daemon" - 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 - stat_fail - exit 1 - fi - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart}" + start) + stat_busy "Starting NTP Daemon" + if [[ -z ${PID} ]] && /usr/bin/ntpd ${NTPD_ARGS} -p "${PIDFILE}" &>/dev/null; then + add_daemon ntpd + stat_done + else + stat_fail + exit 1 + fi + ;; + stop) + stat_busy "Stopping NTP Daemon" + if [[ -n ${PID} ]] && kill "${PID}" &>/dev/null; then + rm ${PIDFILE} + rm_daemon ntpd + stat_done + else + stat_fail + exit 1 + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" esac |