diff options
author | Robert Schwebel <r.schwebel@pengutronix.de> | 2005-05-25 13:32:39 +0000 |
---|---|---|
committer | Robert Schwebel <r.schwebel@pengutronix.de> | 2005-05-25 13:32:39 +0000 |
commit | 7b356b373cae2b8e16f85772070371ef0bb4e3ca (patch) | |
tree | 8642776d838d8b6990a176b3edd7720c6b7276cb /projects | |
parent | e6843bc78dbf975ca58f91569bdea21205b46686 (diff) | |
download | ptxdist-7b356b373cae2b8e16f85772070371ef0bb4e3ca.tar.gz ptxdist-7b356b373cae2b8e16f85772070371ef0bb4e3ca.tar.xz |
git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-0.7-trunk@2668 33e552b5-05e3-0310-8538-816dae2090ed
Diffstat (limited to 'projects')
-rw-r--r-- | projects/generic/etc/init.d/ntp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/projects/generic/etc/init.d/ntp b/projects/generic/etc/init.d/ntp new file mode 100644 index 000000000..483f2b3e3 --- /dev/null +++ b/projects/generic/etc/init.d/ntp @@ -0,0 +1,77 @@ +#!/bin/sh +# +# This is a ntp init.d script which ist called by init(1) with [start|stop] as argument +# PII ntp config +# Wed May 25 14:36:31 CEST 2005 + +PATH=/sbin:/bin:/usr/bin +BINARY=/usr/local/bin/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 + +HARD=false + +# --- nothing to change after this line --- + +test -f $BINARY || { echo "$BINARY not found" >&2 ; exit 0; } + +start_proc() { + echo -n "Starting NTP server: ntpd ..." + test -f "$PIDFILE" && { echo "pid-file exists" >&2 ; exit 0; } + $BINARY -p $PIDFILE -c $CONFIG + echo "DONE" +} + +stop_proc() { + echo -n "Stopping NTP server: ntpd ..." + 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 server: ntpd... " + 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 + |