aboutsummaryrefslogtreecommitdiff
path: root/databases/go-carbon/files/go-carbon.in
blob: c2d5032e6e13860f5c09ce0ab83324245f7c28f3 (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
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: go-carbon
# REQUIRE: LOGIN
# BEFORE:  securelevel
# KEYWORD: shutdown

# Add the following line to /etc/rc.conf to enable `go-carbon':
#
# go_carbon_enable="YES"
#
# optional:
#
# go_carbon_conf (flags):      Set extra flags here. More options in go-carbon(1)
#                               Default is empty "".
# go_carbon_user (user):        Set user to run go-carbon.
#                               Default is "carbon".

. /etc/rc.subr

name="go-carbon"
rcvar="go_carbon_enable"

: ${go_carbon_enable:="NO"}
: ${go_carbon_user:="carbon"}
: ${go_carbon_config:="/usr/local/etc/go-carbon/go-carbon.conf"}

start_cmd="go_carbon_start"
stop_cmd="go_carbon_stop"
status_cmd="go_carbon_status"
procname="/usr/local/bin/go-carbon"
pidfile="/var/run/$name.pid"

# read configuration and set defaults
load_rc_config "$name"

go_carbon_start()
{
	${procname} -config ${go_carbon_config} -daemon -pidfile ${pidfile}
}

go_carbon_stop()
{
	kill -TERM `cat /var/run/go-carbon.pid`
}

go_carbon_status()
{
	echo "go-carbon is running as pid" `cat /var/run/go-carbon.pid`
}

run_rc_command "$1"