xref: /OK3568_Linux_fs/buildroot/package/seatd/S40seatd (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#! /bin/sh
2
3DAEMON="seatd"
4DAEMON_EXE="/usr/bin/${DAEMON}"
5PIDFILE="/run/${DAEMON}.pid"
6
7# Load default env variables from profiles(e.g. /etc/profile.d/seatd.sh)
8. /etc/profile
9
10start() {
11	printf 'Starting %s: ' "${DAEMON}"
12	start-stop-daemon -S -x "${DAEMON_EXE}" -p "${PIDFILE}" -m -b -- -g video
13	status=$?
14	if [ "$status" -eq 0 ]; then
15		echo OK
16	else
17		echo FAIL
18	fi
19	return "$status"
20}
21
22stop() {
23	printf 'Stopping %s: ' "${DAEMON}"
24	start-stop-daemon -K -x "${DAEMON_EXE}" -p "${PIDFILE}"
25	status=$?
26	if [ "$status" -eq 0 ]; then
27		echo OK
28	else
29		echo FAIL
30	fi
31	return "$status"
32}
33
34restart() {
35	stop
36	sleep 1
37	start
38}
39
40case "${1}" in
41	start|stop|restart)
42		"${1}";;
43	reload)
44		restart;;
45	*)
46		echo "Usage: $0 {start|stop|restart}"
47		exit 1
48		;;
49esac
50