ports/databases/couchdb/files/couchdb.in
Ashish SHUKLA 95619f23f1 - Remove extra USERS/GROUPS, which were accidentally added in previous commit[1]
- Fix rc.d script[1]
- Add option to depend on lang/erlang instead of lang/erlang-lite

Submitted by:	till@php.net[1]
Approved by:	till@php.net (maintainer)
2011-08-25 10:58:47 +00:00

64 lines
1.4 KiB
Bash

#!/bin/sh
# PROVIDE: couchdb
# REQUIRE: LOGIN
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# couchdb_enable (bool): Set to NO by default.
# Set it to YES to enable couchdb.
#
# couchdb_enablelogs (bool): Set to YES by default.
#
# couchdb_etcdir (string): In case you want another dir
# for default.ini/local.ini.
#
# couchdb_respawn (int): Set to none by default. If CouchDB crashes,
# respawn after this many seconds.
#
couchdb_user="${couchdb_user:-"couchdb"}"
couchdb_enablelogs="${couchdb_enablelogs:-"YES"}"
couchdb_etcdir="${couchdb_etcdir:-"%%PREFIX%%/etc/couchdb"}"
couchdb_respawn="${couchdb_respawn:-"0"}"
. /etc/rc.subr
name="couchdb"
rcvar=${name}_enable
load_rc_config $name
command="%%PREFIX%%/bin/${name}"
pidfile="/var/run/${name}/${name}.pid"
etcdir="%%PREFIX%%/etc/${name}"
if [ "$couchdb_respawn" -gt 0 ]
then
respawn="-r ${couchdb_respawn} "
fi
if [ "$couchdb_enablelogs" = "YES" ]
then
logfile=/var/log/${name}/couch.log
errfile=/var/log/${name}/err.log
else
logfile=/dev/null
errfile=/dev/null
fi
: ${couchdb_enable="NO"}
: ${couchdb_flags="-b -a ${etcdir}/default.ini -a ${etcdir}/local.ini ${respawn}-o ${logfile} -e ${errfile} -p ${pidfile}"}
start_precmd=pid_touch
stop_cmd="${command} -d"
status_cmd="${command} -s"
pid_touch ()
{
touch $pidfile
chown $couchdb_user $pidfile
}
run_rc_command "$1"