[ptpd/el6] corrected init script
jondkent
jondkent at fedoraproject.org
Thu Jun 12 20:45:54 UTC 2014
commit 9aac25e21b4a9f1cf5d10677cfac6ff9ef7c9eab
Author: Jon Kent <jon.kent at gmail.com>
Date: Thu Jun 12 21:45:37 2014 +0100
corrected init script
ptpd2 | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 94 insertions(+), 9 deletions(-)
---
diff --git a/ptpd2 b/ptpd2
index df74d4c..4bc06c2 100644
--- a/ptpd2
+++ b/ptpd2
@@ -1,10 +1,95 @@
-# Config file location
-PTPD_CONFIG_FILE="/etc/ptpd2.conf"
-# Lock / PID file location
-PTPD_PID_FILE="/var/run/ptpd2.lock"
-# Status file location
-PTPD_STATUS_FILE="/var/log/ptpd2.status"
-
-# Any extra command-line options
-PTPD_EXTRA_OPTIONS=""
+#!/bin/sh
+#
+# ptpd Precision Time Protocol daemon
+#
+# chkconfig: - 30 70
+# description: ptpd implements a sub ms time coordination of LAN connected computers \
+# implementing IEEE 1588
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/ptpd2"
+prog="ptpd2"
+
+if [ -e /etc/sysconfig/$prog ]; then
+ . /etc/sysconfig/$prog
+ PTPD_OPTIONS="--global:lock_file=$PTPD_PID_FILE --global:status_file=$PTPD_STATUS_FILE -c $PTPD_CONFIG_FILE $PTPD_EXTRA_OPTIONS"
+fi
+
+lockfile=/var/lock/subsys/$prog
+
+start() {
+ [ -x $exec ] || exit 5
+ echo -n $"Starting $prog: "
+ daemon --user root $exec $PTPDARGS
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+ killproc $prog
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ restart
+}
+
+force_reload() {
+ restart
+}
+
+rh_status() {
+ # run checks to determine if the service is running or use generic status
+ status $prog
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ force-reload)
+ force_reload
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+ exit 2
+esac
+exit $?
More information about the scm-commits
mailing list