summaryrefslogtreecommitdiff
path: root/package/rpi-userland/S94vcfiled
blob: 4d27b91baef228b2870ad94fa8df57bb74ced309 (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
47
#!/bin/sh

NAME=vcfiled
DESC="VideoCore file server daemon $NAME"
DAEMON="/usr/sbin/$NAME"
DAEMON_ARGS=""
CFGFILE="/etc/default/$NAME"
PIDFILE="/var/run/$NAME.pid"

# Read configuration variable file if it is present
[ -r "$CFGFILE" ] && . "$CFGFILE"

start()
{
	printf "Starting $DESC: "
	start-stop-daemon -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS &&
			echo "done" || echo "failed"
}

stop()
{
	printf "Stopping $DESC: "
	if start-stop-daemon -K -q -R TERM/30/KILL/5 -p "$PIDFILE" -n "$NAME"; then
		# This daemon does not remove its PID file when it exits.
		rm -f "$PIDFILE"
		echo "done"
	else
		echo "failed"
	fi
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart|reload)
		stop
		start
		;;
	*)
		echo "Usage: $0 {start|stop|restart|reload}" >&2
		exit 1
		;;
esac