summaryrefslogtreecommitdiffstats
path: root/textproc/pootle/files/pootle.sh.in
blob: 14bbdd815e61a89c060262f333aec4908d2898de (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
47
48
49
50
51
52
53
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: pootle
# REQUIRE: DAEMON
#
# Add the following lines to /etc/rc.conf to run pootle:
#
# pootle_enable (bool):		Set it to "YES" to enable pootle.
#				Default is "NO".
# pootle_flags (flags):		Set extra flags here. More options in pootle(1)
#				Default is empty "".
# pootle_logdir (path):		Path to pootle log directory.
#				Default is "%%POOTLELOGDIR%%".
#				Empty is log to /dev/null.
# pootle_user (user):		Set user to run pootle.
#				Default is "%%POOTLEUSER%%".
#

. /etc/rc.subr

name=pootle
rcvar=${name}_enable
pidfile="%%POOTLERUNDIR%%/pootle.pid"
command_interpreter="%%PYTHON_CMD%%"

required_files="%%PREFIX%%/etc/pootle/localsettings.py"

command="%%PREFIX%%/bin/PootleServer"

load_rc_config $name
: ${pootle_enable="NO"}
: ${pootle_user="%%POOTLEUSER%%"}
: ${pootle_logdir="%%POOTLELOGDIR%%"}

if [ -n "${pootle_logdir}" ]; then
	pootle_stdout="${pootle_logdir}/access.log"
	pootle_stderr="${pootle_logdir}/error.log"
else
	pootle_stdout="/dev/null"
	pootle_stderr="/dev/null"
fi

start_cmd="pootle_start_cmd"

pootle_start_cmd () {
	[ -z "${rc_quiet}" ] && echo "Starting ${name}."
	/usr/sbin/daemon -p ${pidfile} -u ${pootle_user} ${command} ${pootle_flags} \
		>>${pootle_stdout} 2>>${pootle_stderr}
}

run_rc_command "$1"
OpenPOWER on IntegriCloud