summaryrefslogtreecommitdiff
path: root/databases/py-carbon/files/carbon.in
blob: c583eb1a47bc2ef1a620d7b7335ffbe4138bfa1c (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
56
57
58
59
60
61
62
#!/bin/sh
# 
# $FreeBSD$
# 

# PROVIDE: carbon
# KEYWORD: shutdown

# 
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# carbon_enable (bool):	Set to NO by default.
#			Set it to YES to enable it.
# carbon_conf:		File where carbon configuration resides
#			Default: %%PREFIX%%/etc/carbon/carbon.conf
# carbon_user:		The user account carbon daemon runs as what
#			you want it to be. It uses 'root' user by
#			default.
# carbon_group:		The group account carbon daemon runs as what
#			you want it to be. It uses 'wheel' group by
#			default.
# carbon_debug:		Determines if you want carbon to run in debug
#			mode, it may be very verbose. It will not run
#			in debug by default.
# carbon_logdir:	Directory where carbon logs are stored.
#			Default: /var/db/carbon/log
# 

. /etc/rc.subr

name=carbon
rcvar=carbon_enable

load_rc_config ${name}

: ${carbon_enable:=NO}
: ${carbon_user:=root}
: ${carbon_group:=wheel}
: ${carbon_conf:=%%PREFIX%%/etc/carbon/carbon.conf}
: ${carbon_debug:=NO}
: ${carbon_logdir:=/var/db/carbon/log/}
: ${pidfile:=/var/run/carbon.pid}

stop_cmd="${name}_stop"
required_files="${carbon_conf} %%PREFIX%%/etc/carbon/storage-schemas.conf"

command_interpreter="%%PREFIX%%/bin/python2.7"
command="%%PREFIX%%/bin/carbon-cache.py"
command_args="--config=${carbon_conf} --logdir ${carbon_logdir} --pidfile ${pidfile} start"

carbon_stop()
{
    echo "Stopping $name"
    pids=`check_pidfile ${pidfile} ${command} ${command_interpreter}`

    %%PREFIX%%/bin/carbon-cache.py --config=${carbon_conf} --pidfile ${pidfile} stop
    wait_for_pids ${pids}
}

run_rc_command "$1"