#!/bin/sh # Startup script for Zope # # chkconfig: 2345 80 20 # description: Zope the web application server # # config: $instance/etc/zope.conf # Source function library. . /etc/init.d/functions RETVAL=0 zopectl="/usr/bin/zopectl" user="zope" prog="zope" start() { gprintf "Starting %s: " "$prog" output=`$zopectl -u $user start 2>/dev/null` # the return status of zopectl is not reliable, we need to parse # its output via substring match if gprintf "started\n"; then # success touch /var/lock/subsys/$prog success echo RETVAL=0 else # failed failure echo RETVAL=1 fi return $RETVAL } stop() { gprintf "Stopping %s: " "$prog" output=`$zopectl -u $user stop 2>/dev/null` # the return status of zopectl is not reliable, we need to parse # its output via substring match if gprintf "stopped\n"; then # success rm -f /var/lock/subsys/$prog success echo RETVAL=0 else # failed failure echo RETVAL=1 fi return $RETVAL } restart() { stop start } case "$1" in start) start ;; stop) stop ;; status) $zopectl status ;; restart) restart ;; condrestart) $zopectl status | grep -qs "program running" && restart ;; *) gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" "$0" RETVAL=2 esac exit $RETVAL