Author: jajcus Date: Mon Aug 29 13:38:20 2005 GMT Module: SOURCES Tag: HEAD ---- Log message: - new Zope3 files
---- Files affected: SOURCES: Zope3.init (NONE -> 1.1) (NEW), Zope3.logrotate (NONE -> 1.1) (NEW), Zope3.sysconfig (NONE -> 1.1) (NEW), mkzope3instance (NONE -> 1.1) (NEW) ---- Diffs: ================================================================ Index: SOURCES/Zope3.init diff -u /dev/null SOURCES/Zope3.init:1.1 --- /dev/null Mon Aug 29 15:38:20 2005 +++ SOURCES/Zope3.init Mon Aug 29 15:38:14 2005 @@ -0,0 +1,160 @@ +#!/bin/sh +# Zope 3 +# +# chkconfig: 345 90 10 +# description: Starts and stops the Zope instances +# +# + + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network ]; then + msg_network_down "Zope 3" + exit 1 + fi +else + exit 0 +fi + +# Zope settings. +INSTANCES="main" +[ -f /etc/sysconfig/zope3 ] && . /etc/sysconfig/zope3 + +zope_ctl() +{ + message="$1" + instance_home="$2" + action="$3" + errors="" + typeset -i exit_code=0 + + show "$message"; busy + if ! cd "$instance_home/var" 2>/dev/null ; then + fail + log_failes "$message" + exit_code=1 + errors="Cannot chdir to $instance_home/var" + elif errors=$(initlog -c "su -s/bin/sh zope -c \"$instance_home/bin/zopectl $action\"" 2>&1) ; then + ok + log_success "$message" + else + fail + log_failed "$message" + exit_code=1 + fi + [ -n "$errors" ] && [ $exit_code -eq 1 ] && echo "$errors" + return $exit_code +} + +start_instances() +{ + RETVAL=1 + for INSTANCE_NAME in $INSTANCES + do + INSTANCE_HOME="/var/lib/zope3/$INSTANCE_NAME" + + if [ -f /var/lock/subsys/"zope3-$INSTANCE_NAME" ]; then + msg_already_running "Zope 3 instance $INSTANCE_NAME" + continue + fi + + zope_ctl "Starting Zope instance $INSTANCE_NAME" "$INSTANCE_HOME" start + RET=$? + if [ $RET -eq 0 ]; then + touch /var/lock/subsys/"zope3-$INSTANCE_NAME" + RETVAL=0 + fi + done + return $RETVAL +} + +stop_instances() +{ + RETVAL=1 + for INSTANCE_NAME in $INSTANCES + do + INSTANCE_HOME="/var/lib/zope3/$INSTANCE_NAME" + + if [ ! -f /var/lock/subsys/"zope3-$INSTANCE_NAME" ]; then + msg_not_running "Zope 3 instance $INSTANCE_NAME" + continue + fi + + zope_ctl "Stopping Zope instance $INSTANCE_NAME" "$INSTANCE_HOME" stop + + RET=$? + if [ $RET -eq 0 ]; then + RETVAL=0 + fi + rm -f /var/lock/subsys/"zope3-$INSTANCE_NAME" + done + return $RETVAL +} + +stat_instances() +{ + for INSTANCE_NAME in $INSTANCES + do + INSTANCE_HOME=/var/lib/zope3/"$INSTANCE_NAME" + echo -n "$INSTANCE_NAME: " + cd "$INSTANCE_HOME/var" && "$INSTANCE_HOME"/bin/zopectl status + done +} + +# See how we were called. +case "$1" in + start) + msg_starting "Zope 3" + started + start_instances + RETVAL=$? + if [ "$RETVAL" = 0 ] ; then + msg_starting "Zope 3" + ok + touch /var/lock/subsys/zope + else + msg_starting "Zope 3" + fail + fi + ;; + stop) + if [ -f /var/lock/subsys/zope ]; then + msg_stopping "Zope 3" + started + stop_instances + RETVAL=$? + if [ "$RETVAL" = 0 ] ; then + msg_stopping "Zope 3" + ok + else + msg_stopping "Zope 3" + fail + fi + rm -f /var/lock/subsys/zope >/dev/null 2>&1 + else + msg_not_running "Zope 3" + exit 1 + fi + ;; + status) + stat_instances + ;; + restart|force-reload) + $0 stop + $0 start + exit $? + ;; + *) + msg_usage "$0 {start|stop|restart|force-reload|status}" + exit 3 + ;; +esac + +exit $RETVAL ================================================================ Index: SOURCES/Zope3.logrotate diff -u /dev/null SOURCES/Zope3.logrotate:1.1 --- /dev/null Mon Aug 29 15:38:20 2005 +++ SOURCES/Zope3.logrotate Mon Aug 29 15:38:14 2005 @@ -0,0 +1,6 @@ +/var/log/zope/*/*.log { +create 644 zope zope + postrotate + /etc/rc.d/init.d/zope restart >/dev/null 2>&1 + endscript +} ================================================================ Index: SOURCES/Zope3.sysconfig diff -u /dev/null SOURCES/Zope3.sysconfig:1.1 --- /dev/null Mon Aug 29 15:38:20 2005 +++ SOURCES/Zope3.sysconfig Mon Aug 29 15:38:14 2005 @@ -0,0 +1,10 @@ +# Customized settings for Zope Instances + +# Define nice level for Zope Server +SERVICE_RUN_NICE_LEVEL="+5" + +# Instances to automatically start +INSTANCES="main" + +# Instances for which all products should be automatically installed +AUTO_INSTALL_PRODUCTS="main" ================================================================ Index: SOURCES/mkzope3instance diff -u /dev/null SOURCES/mkzope3instance:1.1 --- /dev/null Mon Aug 29 15:38:20 2005 +++ SOURCES/mkzope3instance Mon Aug 29 15:38:14 2005 @@ -0,0 +1,33 @@ +#!/bin/sh + +instance_name="$1" +instance_home="$DESTDIR/var/lib/zope3/$instance_name" + +if [ -z "$1" -o "$1" = "-h" -o "$1" = "--help" ] ; then + echo "Usage:" + echo " $0 instance_name [mkzopeinstance.py options]" + exit 1 +fi + +if [ -f "$DESTDIR/etc/zope3/$instance_name/zope.conf" ] ; then + echo "Instance already exists" >&2 + exit 1 +fi + +shift + +"$DESTDIR/usr/lib/zope3/bin/mkzopeinstance" -d "$instance_home" $@ || exit $? +mkdir -p "$DESTDIR/etc/zope3/$instance_name" "$DESTDIR/var/log/zope3/$instance_name" +mv "$instance_home/etc"/* "$DESTDIR/etc/zope3/$instance_name" +rmdir "$instance_home/etc" +rm "$instance_home/log/README.txt" +rmdir "$instance_home/log" +ln -s "/etc/zope3/$instance_name" "$instance_home/etc" +ln -s "/var/log/zope3/$instance_name" "$instance_home/log" +chown root:zope "$instance_home/var" "/var/log/zope3/$instance_name" "/etc/zope3/$instance_name" 2>/dev/null +chmod 771 "$instance_home/var" "/var/log/zope3/$instance_name" +chmod 751 "$DESTDIR/etc/zope3/$instance_name" + +if [ -n "$DESTDIR" ] ; then + sed -i -e"s,$DESTDIR,," "$DESTDIR/etc/zope3/$instance_name"/*.conf "$instance_home/bin"/* +fi ================================================================ _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit