Prune x11/hotwire-shell
[dports.git] / www / py-rhodecode / files / rhodecode.in
1 #!/bin/sh
2
3 # $FreeBSD: head/www/py-rhodecode/files/rhodecode.in 326200 2013-09-03 18:56:27Z wg $
4 # PROVIDE: rhodecode
5 # REQUIRE: NETWORKING
6 #
7 # Add the following lines to /etc/rc.conf.local or /etc/rc.conf
8 # to enable this service:
9 #
10 # rhodecode_enable (bool):       Set to NO by default.
11 #               Set it to YES to enable rhodecode.
12 # rhodecode_config (string):
13 #               rhodecode config file for paster
14 # rhodecode_user (string):
15 #               User to run rhodecode
16 # rhodecode_group (string):
17 #               Group to run rhodecode
18
19 . /etc/rc.subr
20
21 name="rhodecode"
22 rcvar=rhodecode_enable
23
24 load_rc_config ${name}
25
26 : ${rhodecode_enable="NO"}
27 : ${rhodecode_config="%%PREFIX%%/etc/rhodecode/production.ini"}
28 : ${rhodecode_user="www"}
29 : ${rhodecode_group="www"}
30
31 pidfile="/var/run/${name}/${name}.pid"
32 logfile="/var/run/${name}.log"
33 command=%%PREFIX%%/bin/paster
34 start_precmd="install -d -o ${rhodecode_user} ${pidfile%/*} && install -o ${rhodecode_user} /dev/null ${logfile}"
35 start_cmd="rhodecode_start"
36 status_cmd="rhodecode_status"
37 stop_cmd="rhodecode_stop"
38
39 rhodecode_start() {
40         ${command} serve \
41                 --user=${rhodecode_user} \
42                 --group=${rhodecode_group} \
43                 --pid-file=${pidfile} \
44                 --log-file=${logfile} \
45                 --daemon \
46                 ${rhodecode_config}
47 }
48
49 rhodecode_status() {
50         ${command} serve \
51                 --pid-file=${pidfile}\
52                 --status \
53                 ${rhodecode_config}
54 }
55
56 rhodecode_stop() {
57         ${command} serve \
58                 --user=${rhodecode_user} \
59                 --group=${rhodecode_group} \
60                 --pid-file=${pidfile} \
61                 --stop-daemon \
62                 ${rhodecode_config}
63 }
64
65 required_files="${rhodecode_config}"
66
67 load_rc_config $name
68 run_rc_command "$1"