summaryrefslogtreecommitdiffstats
path: root/package/linuxptp/S65linuxptp
blob: 46b8921fdd0f5dd343b946e901d9b471ea16c018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/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 $?
OpenPOWER on IntegriCloud