From 16262790cb6ddacf6c632625cc865e03b1b8671f Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Sun, 25 Nov 2012 21:24:58 +0100 Subject: rcdscripts: import first snapshot of rc.d scripts as of 11.25.2012 In 30 days these scripts will start dissapearing from official Arch Linux packages. This is an attempt to conserve them, and keep sysvinit usable. --- src/ntp/ntpd | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/ntp/ntpdate | 29 +++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100755 src/ntp/ntpd create mode 100755 src/ntp/ntpdate (limited to 'src/ntp') diff --git a/src/ntp/ntpd b/src/ntp/ntpd new file mode 100755 index 0000000..480fa10 --- /dev/null +++ b/src/ntp/ntpd @@ -0,0 +1,47 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/conf.d/ntpd.conf + +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" + 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 diff --git a/src/ntp/ntpdate b/src/ntp/ntpdate new file mode 100755 index 0000000..a8e7467 --- /dev/null +++ b/src/ntp/ntpdate @@ -0,0 +1,29 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/conf.d/ntpd.conf + +case "$1" in + start) + stat_busy "Starting NTP Client" + if /usr/bin/ntpd -q ${NTP_CLIENT_OPTION} &>/dev/null; then + add_daemon ntpdate + stat_done + else + stat_fail + exit 1 + fi + ;; + stop) + stat_busy "Stopping NTP Client" + rm_daemon ntpdate + stat_done + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac -- cgit v1.2.3