#!/bin/sh
#
# Startup script for Zeo server component of Plone.
#
# Based on:
# $FreeBSD: ports/www/zope29/files/zeo29.sh.in,v 1.1 2006/01/28 10:07:29 pav Exp $
#

# PROVIDE: zeo2_10
# REQUIRE: DAEMON
# BEFORE: zope2_10

# Define these zeo2_10_* variables in one of these files:
#       /etc/rc.conf
#       /etc/rc.conf.local
#       /etc/rc.conf.d/zeo2_10
#
# zeo2_10_enable : bool
#   Enable Zeo ("YES") or not ("NO", the default).
#
# zeo2_10_instances : list
#   List of dirs with Zeo's instances ("" by default).
#

. /etc/rc.subr

name="zeo2_10"
rcvar=`set_rcvar`

zeo2_10ctl () {
    for instance in $zeo2_10_instances; do
        if [ -d ${instance} ]; then
            echo -n "  Zeo instance ${instance} -> "
            ${instance}/bin/plonectl "$1"
        fi
    done
}

zeo2_10_start () {
    echo "Starting Zeo 2.10:"
    zeo2_10ctl "start"
}

zeo2_10_stop () {
    echo "Stopping Zeo 2.10:"
    zeo2_10ctl "stop"
}

zeo2_10_restart () {
    echo "Restarting Zeo 2.10:"
    zeo2_10ctl "restart"
}

  start_cmd="zeo2_10_start"
   stop_cmd="zeo2_10_stop"
restart_cmd="zeo2_10_restart"

load_rc_config $name

: ${zeo2_10_enable="NO"}
: ${zeo2_10_instances=""}

cmd="$1"
[ $# -gt 0 ] && shift
[ -n  "$*" ] && zeo2_10_instances="$*"

run_rc_command "${cmd}"

