blob: 1b9e3c9300c59d4bc51d35641b1dda2ed90b4dc3 [file] [log] [blame]
#!/bin/sh
#
# Start linuxptp
#
DAEMON="ptp4l"
PIDFILE="/var/run/$DAEMON.pid"
PTP4L_ARGS="-f /etc/linuxptp.cfg"
# shellcheck source=/dev/null
[ -r "/etc/default/ptp4l" ] && . "/etc/default/ptp4l"
start() {
printf "Starting linuxptp daemon: "
start-stop-daemon -S -b -q -m -p $PIDFILE \
-x /usr/sbin/$DAEMON -- $PTP4L_ARGS
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return $status
}
stop() {
printf "Stopping linuxptp daemon: "
start-stop-daemon -K -q -p $PIDFILE
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return $status
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?