summaryrefslogtreecommitdiffstats
path: root/ports-mgmt/redports-node/files/redportsnode.in
blob: 253405151226b1dd78e1ef4528755b975650943b (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
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: redportsnode
# REQUIRE: DAEMON
# BEFORE:  LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf[.local] to enable redportsnode
#
# redportsnode_enable (bool):	Set to "NO" by default.
#				Set it to "YES" to enable redportsnode.

. /etc/rc.subr

name=redportsnode
rcvar=redportsnode_enable

command="%%LOCALBASE%%/bin/redports-node"
command_interpreter="php"
pidfile="/var/run/${name}.pid"

start_cmd="${name}_start"

redportsnode_start()
{
	local pid

	pid=$(check_pidfile $pidfile $command)

	if [ -n "${pid}" ]; then
		echo "${name} already running? (pid=${pid})."
		return 1
	fi

	echo -n "Starting ${name}"
	/usr/sbin/daemon -f -p ${pidfile} ${command}
	echo '.'
}

load_rc_config $name

: ${redportsnode_enable="NO"}

run_rc_command "$1"
OpenPOWER on IntegriCloud