#!/bin/sh # # Startup script for Zope server. # # $FreeBSD: head/www/zope213/files/zope213.in 340872 2014-01-24 00:14:07Z mat $ # # PROVIDE: zope213 # REQUIRE: LOGIN # KEYWORD: shutdown # Define these zope213_* variables in one of these files: # /etc/rc.conf # /etc/rc.conf.local # # zope213_enable : bool # Enable Zope ("YES") or not ("NO", the default). # # zope213_instances : list # List of dirs with Zope's instances ("" by default). # . /etc/rc.subr name="zope213" rcvar=zope213_enable load_rc_config $name : ${zope213_enable:="NO"} : ${zope213_instances:="%%ZOPEINSTANCEDIR%%"} zope213_check_instances () { cmd="$1" shift if [ -n "$*" ]; then zope213_instances="$@" elif [ -z "$zope213_instances" ]; then err 1 "No value for zope213_instances, so nothing to do" fi } zope213ctl () { local instance for instance in $zope213_instances; do if [ -d ${instance} ]; then echo -n " Zope instance ${instance} -> " ${instance}/bin/zopectl "$1" fi done } zope213_start () { zope213_check_instances echo -n 'Starting Zope 2.13:' zope213ctl "start" echo '.' } zope213_stop () { zope213_check_instances echo -n 'Stopping Zope 2.13:' zope213ctl "stop" echo '.' } zope213_restart () { zope213_check_instances echo -n 'Restarting Zope 2.13:' zope213ctl "restart" echo '.' } start_cmd="${name}_start" stop_cmd="${name}_stop" restart_cmd="${name}_restart" cmd="$1" shift if [ -n "$*" ]; then zope213_instances="$@" fi run_rc_command "${cmd}"