#!/bin/sh # # $FreeBSD$ # # PROVIDE: pootle # REQUIRE: DAEMON # KEYWORD: shutdown # # 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 /var/log/pootle # Empty is log to /dev/null. # pootle_user (user): Set user to run pootle. # Default is "%%POOTLEUSER%%". # . /etc/rc.subr name=pootle rcvar=pootle_enable load_rc_config $name : ${pootle_enable:=NO} : ${pootle_user="%%POOTLEUSER%%"} : ${pootle_group="%%POOTLEGROUP%%"} : ${pootle_logdir=/var/log/pootle} pidfile="%%POOTLERUNDIR%%/pootle.pid" command_interpreter="%%PYTHON_CMD%%" required_files="%%PREFIX%%/etc/pootle/localsettings.py" command="%%PREFIX%%/bin/PootleServer" start_command=pootle_start_cmd start_precmd=pootle_start_precmd 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} } pootle_start_precmd() { for i in db log run ; do install -d -o ${pootle_user} -g ${pootle_group} -m 770 /var/${i}/pootle done 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 } run_rc_command "$1"