]> git.pld-linux.org Git - packages/Zope3.git/commitdiff
- new Zope3 files
authorJacek Konieczny <jajcus@pld-linux.org>
Mon, 29 Aug 2005 13:38:14 +0000 (13:38 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    Zope3.init -> 1.1
    Zope3.logrotate -> 1.1
    Zope3.sysconfig -> 1.1
    mkzope3instance -> 1.1

Zope3.init [new file with mode: 0644]
Zope3.logrotate [new file with mode: 0644]
Zope3.sysconfig [new file with mode: 0644]
mkzope3instance [new file with mode: 0644]

diff --git a/Zope3.init b/Zope3.init
new file mode 100644 (file)
index 0000000..4744a5a
--- /dev/null
@@ -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
diff --git a/Zope3.logrotate b/Zope3.logrotate
new file mode 100644 (file)
index 0000000..df2299e
--- /dev/null
@@ -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
+}
diff --git a/Zope3.sysconfig b/Zope3.sysconfig
new file mode 100644 (file)
index 0000000..6547f26
--- /dev/null
@@ -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"
diff --git a/mkzope3instance b/mkzope3instance
new file mode 100644 (file)
index 0000000..75b73c4
--- /dev/null
@@ -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
This page took 0.086214 seconds and 4 git commands to generate.