[Zope-CVS] CVS: Products/OSCOM - buildout_zope_sandbox:1.5

Tres Seaver tseaver@zope.com
Wed, 7 May 2003 17:27:16 -0400


Update of /cvs-repository/Products/OSCOM
In directory cvs.zope.org:/tmp/cvs-serv20585

Modified Files:
	buildout_zope_sandbox 
Log Message:
 - Coalesce 2.6 start / stop scripts into ctl scripts.

=== Products/OSCOM/buildout_zope_sandbox 1.4 => 1.5 ===
--- Products/OSCOM/buildout_zope_sandbox:1.4	Wed May  7 15:45:14 2003
+++ Products/OSCOM/buildout_zope_sandbox	Wed May  7 17:27:16 2003
@@ -349,10 +349,10 @@
 #------------------------------------------------------------------------------
 
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
-    cat > $bindir/start_zeo << START_ZEO_EOF
+    cat > $bindir/zeoctl << ZEOCTL_EOF
 #!/bin/sh
 #------------------------------------------------------------------------------
-#   Start ZEO storage server
+#   Control the  ZEO storage server
 #------------------------------------------------------------------------------
 zeo_port=8001
 python=$bindir/python
@@ -360,28 +360,49 @@
 
 INSTANCE_HOME=$vardir/storage
 export INSTANCE_HOME
+pidfile=\$INSTANCE_HOME/var/ZEO_SERVER.pid
 
-echo \$python \$zeo_start -p \$zeo_port "\$@"
-\$python \$zeo_start -p \$zeo_port "\$@"
-START_ZEO_EOF
-    chmod +x $bindir/start_zeo
+start_zeo () {
+    echo Starting ZEO storage server
+    echo \$python \$zeo_start -p \$zeo_port "\$@"
+    \$python \$zeo_start -p \$zeo_port "\$@"
+}
 
-    cat > $bindir/stop_zeo << STOP_ZEO_EOF
-#!/bin/sh
-#------------------------------------------------------------------------------
-#   Stop ZEO storage server
-#------------------------------------------------------------------------------
-pid=\`cat $vardir/storage/var/ZEO_SERVER.pid\`
+stop_zeo () {
+    echo Stopping ZEO storage server
+    pid=\`cat \$pidfile\`
+
+    echo kill "\$@" \$pid
+    kill "\$@" \$pid
+}
+
+case "\$1" in
+
+start)
+    start_zeo
+    ;;
+
+stop)
+    stop_zeo
+    ;;
+
+restart)
+   stop_zeo
+   start_zeo
+   ;;
 
-echo kill "\$@" \$pid
-kill "\$@" \$pid
-STOP_ZEO_EOF
-    chmod +x $bindir/stop_zeo
+*)
+    echo "zeoctl [ start | stop | restart ]"
 
-    cat > $bindir/start_zope << START_ZOPE_EOF
+esac
+
+ZEOCTL_EOF
+    chmod +x $bindir/zeoctl
+
+    cat > $bindir/zopectl << ZOPECTL_EOF
 #!/bin/sh
 #------------------------------------------------------------------------------
-#   Start Zope application storage server
+#   Control Zope application storage server
 #------------------------------------------------------------------------------
 www_port=8080
 python=$bindir/python
@@ -392,23 +413,42 @@
 SOFTWARE_HOME=\$zope_home/lib/python
 PYTHONPATH=\$SOFTWARE_HOME:\$PYTHONPATH
 export INSTANCE_HOME SOFTWARE_HOME PYTHONPATH
+pidfile=\$INSTANCE_HOME/var/Z2.pid
 
-echo \$python \$zope_start -X -w \$www_port "\$@"
-\$python \$zope_start -X -w \$www_port "\$@"
-START_ZOPE_EOF
-    chmod +x $bindir/start_zope
-
-    cat > $bindir/stop_zope << STOP_ZOPE_EOF
-#!/bin/sh
-#------------------------------------------------------------------------------
-#   Stop Zope application server
-#------------------------------------------------------------------------------
-pid=\`cat $vardir/zope/var/Z2.pid\`
-
-echo kill "\$@" \$pid
-kill "\$@" \$pid
-STOP_ZOPE_EOF
-    chmod +x $bindir/stop_zope
+start_zope () {
+    echo Starting Zope application server
+    echo \$python \$zope_start -X -w \$www_port "\$@"
+    \$python \$zope_start -X -w \$www_port "\$@"
+}
+
+stop_zope () {
+    echo Stopping Zope application server
+    pid=\`cat \$pidfile\`
+    echo kill "\$@" \$pid
+    kill "\$@" \$pid
+}
+
+case "\$1" in
+
+start)
+    start_zope
+    ;;
+
+stop)
+    stop_zope
+    ;;
+
+restart)
+   stop_zope
+   start_zope
+   ;;
+
+*)
+    echo "zopectl [ start | stop | restart ]"
+
+esac
+ZOPECTL_EOF
+    chmod +x $bindir/zopectl
 
 else  # Zope 2.7+
 
@@ -422,10 +462,5 @@
 #------------------------------------------------------------------------------
 cd $sandbox
 
-if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
-    $bindir/start_zeo
-    $bindir/start_zope
-else
-    $bindir/zeoctl start
-    $bindir/zopectl start
-fi
+$bindir/zeoctl start
+$bindir/zopectl start