xref: /OK3568_Linux_fs/buildroot/package/connman/S45connman (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2
3DAEMON="connmand"
4PIDFILE="/var/run/$DAEMON.pid"
5
6CONNMAND_ARGS="-n"
7
8# shellcheck source=/dev/null
9[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
10
11start() {
12	printf 'Starting %s: ' "$DAEMON"
13	# shellcheck disable=SC2086 # we need the word splitting
14	start-stop-daemon -S -q -m -b -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
15		-- $CONNMAND_ARGS
16	status=$?
17	if [ "$status" -eq 0 ]; then
18		echo "OK"
19	else
20		echo "FAIL"
21	fi
22	return "$status"
23}
24
25stop() {
26	printf 'Stopping %s: ' "$DAEMON"
27	start-stop-daemon -K -q -p "$PIDFILE"
28	status=$?
29	if [ "$status" -eq 0 ]; then
30		echo "OK"
31	else
32		echo "FAIL"
33	fi
34	return "$status"
35}
36
37restart() {
38	stop
39	sleep 1
40	start
41}
42
43case "$1" in
44	start|stop|restart)
45		"$1";;
46	reload)
47		# Restart, since there is no true "reload" feature.
48		restart;;
49	*)
50		echo "Usage: $0 {start|stop|restart|reload}"
51		exit 1
52esac
53