aboutsummaryrefslogtreecommitdiffstats
path: root/main/omxplayer/omxplayer.initd
blob: 2b2c1b87432d8aeb0633fe4bc46a36ebf1168e5c (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
#!/sbin/runscript

depend() {
	after net firewall chrony
}

omxplayer_run_loop() {
	while true; do
		/usr/bin/omxplayer "$@"
		status=$?
		echo "exited: $status"
		[ "$status" -eq 129 ] && exit 0
		sleep 0.2
	done
}

checkconfig() {
	[ -z "$OMXPLAYER_URL" ] && eerror "omxplayer URL not set"
	return 0
}

start() {
	checkconfig || return 1
	ebegin "Starting omxplayer"
	omxplayer_run_loop ${OMXPLAYER_OPTS} "${OMXPLAYER_URL}" 2>&1 | logger -t omxplayer &
	eend $?
}

stop() {
	ebegin "Stopping omxplayer"
	killall -HUP omxplayer
	eend $?
}