diff options
Diffstat (limited to 'www/zope211/files/zope28.sh.in')
-rw-r--r-- | www/zope211/files/zope28.sh.in | 80 |
1 files changed, 46 insertions, 34 deletions
diff --git a/www/zope211/files/zope28.sh.in b/www/zope211/files/zope28.sh.in index 899982321f2b..e51d5fa39140 100644 --- a/www/zope211/files/zope28.sh.in +++ b/www/zope211/files/zope28.sh.in @@ -1,53 +1,65 @@ #!/bin/sh - -# Start or stop zope +# +# Startup script for Zope server. +# # $FreeBSD$ +# # PROVIDE: zope28 # REQUIRE: DAEMON -# BEFORE: LOGIN -# KEYWORD: FreeBSD shutdown -# -prefix=%%PREFIX%% # Define these zope28_* variables in one of these files: # /etc/rc.conf # /etc/rc.conf.local # /etc/rc.conf.d/zope28 # -# DO NOT CHANGE THESE DEFAULT VALUES HERE +# zope28_enable : bool +# Enable Zope ("YES") or not ("NO", the default). +# +# zope28_instances : list +# List of dirs with Zope's instances ("" by default). # -zope28_enable=${zope28_enable:-"NO"} # Enable zope -zope28_instances=${zope28_instances:-""} # List of instancehome dirs . %%RC_SUBR%% name="zope28" rcvar=`set_rcvar` + +zope28ctl () { + for instance in $zope28_instances; do + if [ -d ${instance} ]; then + echo -n " Zope instance ${instance} -> " + ${instance}/bin/zopectl "$1" + fi + done +} + +zope28_start () { + echo "Starting Zope 2.8:" + zope28ctl "start" +} + +zope28_stop () { + echo "Stopping Zope 2.8:" + zope28ctl "stop" +} + +zope28_restart () { + echo "Restarting Zope 2.8:" + zope28ctl "restart" +} + + start_cmd="zope28_start" + stop_cmd="zope28_stop" +restart_cmd="zope28_restart" + load_rc_config $name -if checkyesno zope28_enable; then - - case "$1" in - start) - echo "Starting Zope 2.8" - ;; - stop) - echo "Stopping Zope 2.8" - ;; - restart) - echo "Restarting Zope 2.8" - ;; - *) - echo "Unknown action \"$1\"" - ;; - esac - - for instance in $zope28_instances - do - if [ -r ${instance}/etc/zope.conf -a -x ${instance}/bin/zopectl ]; then - echo -n " Instance ${instance} -> " - ${instance}/bin/zopectl $1 - fi - done -fi +: ${zope28_enable="NO"} +: ${zope28_instances=""} + +cmd="$1" +[ $# -gt 0 ] && shift +[ -n "$*" ] && zope28_instances="$*" + +run_rc_command "${cmd}" |