summaryrefslogtreecommitdiff
path: root/www/py-rhodecode/files/rhodecode.in
blob: 41887a9b47b6dc7983f5ced509b2034cb50d541e (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
63
64
65
66
67
68
#!/bin/sh

# $FreeBSD$
# PROVIDE: rhodecode
# REQUIRE: NETWORKING
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# rhodecode_enable (bool):       Set to NO by default.
#               Set it to YES to enable rhodecode.
# rhodecode_config (string):
#               rhodecode config file for paster
# rhodecode_user (string):
#               User to run rhodecode
# rhodecode_group (string):
#               Group to run rhodecode

. /etc/rc.subr

name="rhodecode"
rcvar=rhodecode_enable

load_rc_config ${name}

: ${rhodecode_enable="NO"}
: ${rhodecode_config="%%PREFIX%%/etc/rhodecode/production.ini"}
: ${rhodecode_user="www"}
: ${rhodecode_group="www"}

pidfile="/var/run/${name}/${name}.pid"
logfile="/var/run/${name}.log"
command=%%PREFIX%%/bin/paster
start_precmd="install -d -o ${rhodecode_user} ${pidfile%/*} && install -o ${rhodecode_user} /dev/null ${logfile}"
start_cmd="rhodecode_start"
status_cmd="rhodecode_status"
stop_cmd="rhodecode_stop"

rhodecode_start() {
	${command} serve \
		--user=${rhodecode_user} \
		--group=${rhodecode_group} \
		--pid-file=${pidfile} \
		--log-file=${logfile} \
		--daemon \
		${rhodecode_config}
}

rhodecode_status() {
	${command} serve \
		--pid-file=${pidfile}\
		--status \
		${rhodecode_config}
}

rhodecode_stop() {
	${command} serve \
		--user=${rhodecode_user} \
		--group=${rhodecode_group} \
		--pid-file=${pidfile} \
		--stop-daemon \
		${rhodecode_config}
}

required_files="${rhodecode_config}"

load_rc_config $name
run_rc_command "$1"