summaryrefslogtreecommitdiff
path: root/net/serviio/files/serviio.in
blob: c0977503227159583b3c49a8044f8a3883fec33b (plain) (blame)
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
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: serviio
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf[.local] to enable serviio:
#
# serviio_enable="YES"

. /etc/rc.subr

name=serviio
rcvar=serviio_enable
command=%%PREFIX%%/sbin/serviiod

load_rc_config $name

: ${serviio_user="dlna"}

if [ -n "${serviio_lang}" ]; then
	export LANG=${serviio_lang}
fi

_dirs="/var/db/serviio /var/db/serviio/home /var/log/serviio"
start_precmd="mkdir -p $_dirs; chown $serviio_user $_dirs"
command_args="$serviio_args &"

stop_cmd="$command -stop"

status_cmd=${name}_status
serviio_status() {
	serviio_pid=$(ps -wwwaU ${serviio_user} | awk '/java.*org.serviio.MediaServer/ {print $1}')
	if [ -n "${serviio_pid}" ]; then
		echo "${name} is running as pid ${serviio_pid}"
	else
		echo "${name} is not running"
		return 1
	fi
}

run_rc_command $1