![Petr Kulhavy](/assets/img/avatar_default.png)
Add the Linux PTP Project package. http://linuxptp.sourceforge.net/ The SysV and systemd init scripts start the daemon in slave-only mode on eth0 and synchronize the system clock to PTP. Signed-off-by: Petr Kulhavy <brain@jikos.cz> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
47 lines
898 B
Bash
Executable file
47 lines
898 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Start linuxptp
|
|
#
|
|
|
|
start() {
|
|
printf "Starting linuxptp daemon: "
|
|
start-stop-daemon -S -b -q -p /var/run/linuxptp-ptp4l.pid \
|
|
-x /usr/sbin/ptp4l -- -f /etc/linuxptp.cfg
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
|
|
|
printf "Starting linuxptp system clock synchronization: "
|
|
start-stop-daemon -S -b -q -p /var/run/linuxptp-phc2sys.pid \
|
|
-x /usr/sbin/phc2sys -- -s eth0 -c CLOCK_REALTIME -w -S 1.0
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
|
}
|
|
|
|
stop() {
|
|
printf "Stopping linuxptp system clock synchronization: "
|
|
start-stop-daemon -K -q -p /var/run/linuxptp-phc2sys.pid \
|
|
-x /usr/sbin/phc2sys
|
|
echo "OK"
|
|
|
|
printf "Stopping linuxptp daemon: "
|
|
start-stop-daemon -K -q -p /var/run/linuxptp-ptp4l.pid \
|
|
-x /usr/sbin/ptp4l
|
|
echo "OK"
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart|reload)
|
|
stop
|
|
start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|
|
|
|
exit $?
|