1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00
freebsd-ports/finance/odoo/files/odoo.in
Jose Alonso Cardenas Marquez e422f43e42 - New port: finance/odoo
Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce,
Warehouse Management, Project Management, Billing & Accounting, Point of Sale,
Human Resources, Marketing, Manufacturing, etc

Odoo Apps can be used as stand-alone applications, but they also integrate
seamlessly so you get a full-featured Open Source ERP when you install several
Apps.

WWW: https://www.odoo.com
2020-05-07 01:50:43 +00:00

116 lines
2.6 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: odoo
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# Configuration settings for odoo in /etc/rc.conf:
#
# odoo_enable: run odoo server (default=NO)
# odoo_database: define odoo database name (default=odoodb)
# odoo_datadir: directory where odoo store data (default=/var/lib/odoo)
# odoo_flags: additional flags for odoo server (default=--without-demo=all)
#
. /etc/rc.subr
name=odoo
rcvar=odoo_enable
load_rc_config ${name}
: ${odoo_enable:=NO}
: ${odoo_database:="odoodb"}
: ${odoo_datadir:="/var/lib/${name}"}
: ${odoo_flags="--without-demo=all"}
odoo_user="odoo"
pidfile=/var/run/odoo.pid
extra_commands="initdb"
su_cmd="/usr/bin/su"
chown_cmd="/usr/sbin/chown"
mkdir_cmd="/bin/mkdir"
start_cmd="odoo_start"
stop_cmd="odoo_stop"
status_cmd="odoo_status"
restart_cmd="odoo_restart"
initdb_cmd="odoo_initdb"
start_precmd="odoo_start_precmd"
command=/usr/local/bin/odoo
command_args="--database=${odoo_database} --data-dir=${odoo_datadir} --logfile=/var/log/${name}.log --config=%%LOCALBASE%%/etc/odoo.conf ${odoo_flags}"
odoo_start_precmd() {
odoo_datadir_check
touch ${pidfile}
${chown_cmd} -R ${odoo_user}:${odoo_user} ${pidfile}
}
odoo_start()
{
daemon -p ${pidfile} -u ${odoo_user} \
${command} ${command_args}
echo "Started"
}
odoo_datadir_check()
{
if [ ! -d "${odoo_datadir}" ]; then
${mkdir_cmd} -p ${odoo_datadir}
${chown_cmd} -R ${odoo_user}:${odoo_user} ${odoo_datadir}
echo "Data directory created"
fi
}
odoo_initdb()
{
echo " "
echo "#################################################################"
echo "# #"
echo "# Don't use initdb if you are updating from previous version of #"
echo "# Odoo. Cancel if this is your case (Ctrl + C) #"
echo "# #"
echo "#################################################################"
echo " "
sleep 10
odoo_start_precmd
daemon -p ${pidfile} -u ${odoo_user} \
${command} ${command_args} -i all
echo "Initializing database and starting odoo server"
}
odoo_restart()
{
echo "Performing restart"
odoo_stop
sleep 5
odoo_start
}
odoo_status()
{
# If running, show pid
if [ -f ${pidfile} ]
then
echo "${name} is running as pid" `cat ${pidfile}`
else
echo "${name} is not running"
fi
}
odoo_stop()
{
if [ -f ${pidfile} ]
then
kill `cat ${pidfile}`
rm ${pidfile}
echo "Stopped"
fi
}
run_rc_command "$1"