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