Re: The way Apache is restarted and the WO adaptor & MacOSX 10.3 Server deployement

Pierre Frisch <[email protected]>
Newsgroups gmane.comp.web.webobjects.admin
Message-ID <[email protected]>
Hi Will,

This is the script that I use on 10.3 with 5.2.2 and it starts and stop  
WebObjects. I am not sure if this will work in 5.1.3 I do not think  
there is anything specific in here about Panther or 5.2.2.

Please note the launch parameters that I have tailored to my  
installation and may not be appropriate for yours. Also note that I  
changed from zsh to bash which is now the default on Panther.

Pierre
--
Pierre Frisch
sPearWay Ltd.
sPearCat Web Catalogs, the flexibility of custom design, the price of a  
package.
http://www.spearcat.com/


On Jan 9, 2004, at 14:35, Will Scheidegger wrote:

> Hm... it seems like the "new" start script is for panther only (or  
> maybe for WO 5.2?). This script (although fixed as described in  
> http://www.omnigroup.com/mailman/archive/webobjects-dev/2003-April/ 
> 033202.html) does not stop WO on my MacOS X Server 10.2.? / WO 5.1.3.
>
> Can anyone confirm this? I guess I'm looking at a fresh install of (at  
> least) WO. Grrr... almost like M$.
>
> -Will


#!/bin/bash
#
# Start and Stop WebObjects Services
#

. /etc/rc.common


WOSERVICE="/System/Library/WebObjects/JavaApplications/wotaskd.woa/ 
Contents/Resources/javawoservice.sh"

WOTASKD="/System/Library/WebObjects/JavaApplications/wotaskd.woa/ 
wotaskd"
WOJAVAMONITOR="/System/Library/WebObjects/JavaApplications/ 
JavaMonitor.woa/JavaMonitor"

WOSERVICE_OPTIONS=" -waitTime 60 -retries 10 -scaleTimeouts YES  
-scaleFactor 2 "
# WOTASKD_OPTIONS=" -WOHost antrax.spearway.com  
-WOAssumeApplicationIsDeadMultiplier 10 -WOSavesAdaptorConfiguration  
true -WOShouldUseSpawn true -WORespondsToMulticastQuery false  
-WODebuggingEnabled
  true -_DeploymentDebugging true "
WOTASKD_OPTIONS=" -WOHost antrax.spearway.com  
-WOAssumeApplicationIsDeadMultiplier 10 -WOSavesAdaptorConfiguration  
true -WORespondsToMulticastQuery false -WOShouldUseSpawn true  
-WODebuggingEnabled t
rue "
WOMONITOR_OPTIONS=" -WOHost antrax.spearway.com -WOPort 20000  
-WOAutoOpenInBrowser NO -WOAllowsConcurrentRequestHandling true  
-WOOutputPath=/Library/WebObjects/Logs/JavaMonitor.log "

GREP=/usr/bin/grep
AWK=/usr/bin/awk
PS=/bin/ps

PRINTSTARTSTOPMESSAGES="YES"

##
# Start WebObjects services
#       (Services to be stopped by this script must use  
"javawoservice.sh".)
##
StartService ()
{
         if [ -x "${WOSERVICE}" ]; then

                 if [ "${PRINTSTARTSTOPMESSAGES}" = "YES" ]; then
                         ConsoleMessage "Starting WebObjects services"
                 fi
                 # move wotaksd logs
                 if [ -e /var/log/webobjects.log ]; then
                         mv /var/log/webobjects.log  
/var/log/webobjects.log.1
                 fi

                 # move Java Monitor logs
                 if [ -e /Library/WebObjects/Logs/JavaMonitor.log ]; then
                         mv /Library/WebObjects/Logs/JavaMonitor.log  
/Library/WebObjects/Logs/JavaMonitor.log.1
                 fi

                 ####
                 # OSX Server now has the 'appserver' and 'appserveradm'  
for security
                 # For Panther Server, wotaskd and javawoservice.sh are  
owned
                 # by the appserver user.  By launch

                 if [ "${PRINTSTARTSTOPMESSAGES}" = "YES" ]; then
                         ConsoleMessage "Starting WOTaskd"
                 fi
                 "${WOSERVICE}" -appPath "${WOTASKD}" ${WOTASKD_OPTIONS}  
 >/var/log/webobjects.log 2>&1 &

                 if [ "${PRINTSTARTSTOPMESSAGES}" = "YES" ]; then
                         ConsoleMessage "Starting Java Monitor"
                 fi
                 # Uncomment the next line to start Monitor
                 "${WOSERVICE}" -appPath "${WOJAVAMONITOR}"  
${WOMONITOR_OPTIONS} >>/var/log/webobjects.log 2>&1 &
                 ####

         fi
}

##
# Stop WebObjects Services
#       (Stop all services run by "javawoservice.sh".)
##
StopService ()
{
         if [ "${PRINTSTARTSTOPMESSAGES}" = "YES" ]; then
                 ConsoleMessage "Stopping WebObjects services"
         fi

         WOSERVICEPIDS=`$PS -jaxwwwww | $GREP "$WOSERVICE" | $GREP -v  
grep | $AWK 'ORS=" " {print $2}'`

         parents=""
         children=""

         for parent in $WOSERVICEPIDS
         {
                 WOSERVICECHILDPIDS=`$PS -jaxwwwww | $AWK 'NF>3 {if ( $3  
=='"$parent"' ) print $2}'`

                 #StopPID $parent
                  parents="$parents $parent"

                 for child in $WOSERVICECHILDPIDS
                 {
                         #StopPID $child
                             children="$children $child"
                 }

         }

         #kill them all at once
         kill -KILL $parents $children
}

##
# Restart WebObjects Services
##
RestartService ()
{
         ConsoleMessage "Restarting WebObjects services"

         PRINTSTARTSTOPMESSAGES="NO"

         StopService
         StartService
}

##
# Stop Process by PID
##
StopPID ()
{
         `kill "$1"`
}

RunService "$1"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.