summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorJuergen Beisert <j.beisert@pengutronix.de>2009-07-04 14:00:43 +0000
committerJuergen Beisert <j.beisert@pengutronix.de>2009-07-04 14:00:43 +0000
commit9f3702afb235b4a635acc3e9e6e2626ae954b2f6 (patch)
treee2d9e17292e4e295f21d6e7d884637d96e48f553 /generic
parent31f9fbce3cf319a1f38501040e5d11759df5309d (diff)
downloadptxdist-9f3702afb235b4a635acc3e9e6e2626ae954b2f6.tar.gz
ptxdist-9f3702afb235b4a635acc3e9e6e2626ae954b2f6.tar.xz
* ntp: Adding the forgotten changed start scripts.
git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@10938 33e552b5-05e3-0310-8538-816dae2090ed
Diffstat (limited to 'generic')
-rw-r--r--generic/etc/init.d/ntp-client64
-rw-r--r--generic/etc/init.d/ntp-server (renamed from generic/etc/init.d/ntp)14
2 files changed, 65 insertions, 13 deletions
diff --git a/generic/etc/init.d/ntp-client b/generic/etc/init.d/ntp-client
new file mode 100644
index 000000000..edca3f297
--- /dev/null
+++ b/generic/etc/init.d/ntp-client
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# This is a ntp-client init.d script which ist called by init(1) with
+# [start|stop] as argument
+
+PATH=/sbin:/bin:/usr/bin
+BINARY=/usr/sbin/ntpdc
+PIDFILE="/var/run/ntpdc.pid"
+CONFIG="/etc/ntp-client.conf"
+
+HARD=false
+
+# --- nothing to change after this line ---
+
+test -f $BINARY || { echo "$BINARY not found" >&2 ; exit 0; }
+
+start_proc() {
+ echo -n "Starting NTP client: ntpdc ..."
+ test -f "$PIDFILE" && { echo "pid-file exists" >&2 ; exit 0; }
+ $BINARY -p $PIDFILE -c $CONFIG
+ echo "DONE"
+}
+
+stop_proc() {
+ echo -n "Stopping NTP client: ntpdc ..."
+ test -f "$PIDFILE"
+ case $? in
+ 0)
+ kill `cat $PIDFILE` && rm -f $PIDFILE
+ ;;
+ *)
+ if [ "$HARD" = "true" ] ; then killall ntpd; fi
+ ;;
+ esac
+ echo "DONE"
+}
+
+
+case "$1" in
+ start)
+ start_proc
+ ;;
+ stop)
+ stop_proc
+ ;;
+ restart|force-reload)
+ echo -n "Restarting NTP client: ntpdc... "
+ stop_proc
+ sleep 2
+ start_proc
+ echo "done."
+ ;;
+ reload)
+ echo "Not supported" >&2
+ exit 1
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
+
diff --git a/generic/etc/init.d/ntp b/generic/etc/init.d/ntp-server
index e17168603..b56cc41e6 100644
--- a/generic/etc/init.d/ntp
+++ b/generic/etc/init.d/ntp-server
@@ -7,19 +7,7 @@
PATH=/sbin:/bin:/usr/bin
BINARY=/usr/sbin/ntpd
PIDFILE="/var/run/ntpd.pid"
-
-case "`basename $0`" in
- *ntp-client)
- CONFIG="/etc/ntp-client.conf"
- ;;
- *ntp-server)
- CONFIG="/etc/ntp-server.conf"
- ;;
- *)
- echo "script has to be ntp-client or ntp-server"
- exit 1
- ;;
-esac
+CONFIG="/etc/ntp-server.conf"
HARD=false