summaryrefslogtreecommitdiff
path: root/net-misc/crossbar/files/initd
blob: 565dfb304aea40143b440ae7a689eba1b66ed117 (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
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

NODE=${RC_SVCNAME:9}

command=/usr/bin/crossbar
command_args="start --cbdir=${BASEDIR}/${NODE} --logtofile --colour=false --loglevel=${LOGLEVEL}"
command_background=true
description="start crossbar wamp router for ${NODE}"
pidfile="${BASEDIR}/${NODE}/crossbar.pid"


depend() {
	need net
}

checkconfig() {
	if [ -z "${BASEDIR}" ]; then
		eerror "BASEDIR not set"
		return 1
	fi
	if [ -z "${USERNAME}" ]; then
		eerror "USERNAME not set"
		return 1
	fi
	if [ ! -d "${BASEDIR}" ]; then
		eerror "${BASEDIR} is not a directory"
		return 1
	fi
	if [ ! -e "${BASEDIR}/${NODE}" ]; then
		eerror "${BASEDIR} does not contain a ${NODE} sub directory"
		return 1
	fi
}