freebsd-ports/finance/trytond/files/trytond.in
Wen Heping 9c1d653785 - Create gid and uid for tryton daemon and use them via USERS and GROUPS variables at Makefile
- Install the existing rc.d script (define USE_RC_SUBR at Makefile)
- Define the command_interpreter variable at the rc.d script (stop and status commands need it)
- Create needed directories at trytond_prestart (rc.d script) with appropriate gid and launch install once
- Rename option OPENSSL -> PYOPENSSL
- Make use of configuration and sample file (both for the port and for the package)

PR:		171716
Submitted by:	bsam@, Matthias Petermann <matthias@d2ux.net>(via Email)
2012-09-18 00:57:12 +00:00

41 lines
1.1 KiB
Bash

#!/bin/sh
# $FreeBSD: ports/finance/trytond/files/trytond.in,v 1.1 2012/08/18 07:18:24 wen Exp $
#
# PROVIDE: trytond
# REQUIRE: postgresql LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable trytond
#
#
# trytond_enable (bool): Set to "NO" by default,
# Set it to "YES" to enable trytond
. /etc/rc.subr
name=trytond
rcvar=trytond_enable
load_rc_config $name
trytond_enable="${trytond_enable:-"NO"}"
trytond_config="${trytond_config:-"%%PREFIX%%/etc/trytond.conf"}"
trytond_user="${trytond_user:-"trytond"}"
trytond_logdir="${trytond_logdir:-"$(dirname `grep logfile %%PREFIX%%/etc/trytond.conf | awk -F "=" ' { print $2 } ' `)"}"
command=%%PREFIX%%/bin/trytond
command_interpreter=%%PYTHON%%
command_args="--config=${trytond_config} >/dev/null 2>&1 &"
pidfile="${trytond_pidfile:-"$(grep pidfile %%PREFIX%%/etc/trytond.conf | awk -F "=" ' { print $2 } ' |sed 's/[ ]//g' )"}"
required_files="${trytond_config}"
start_precmd="${name}_prestart"
trytond_prestart ()
{
install -d -o ${trytond_user} -g ${trytond_user} $(dirname "${pidfile}") "${trytond_logdir}"
}
run_rc_command "$1"