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]>
If I am not mistaken this is the "old" start script. I don't remember  
when it was changed for the "new" one with a stop section. However this  
was already changed in June for WWDC as I complained about it to Karl  
and he knew the problem so it must have been 5.2 or 5.2.1. This was not  
much of a concern then as WO was stable on 10.2. I only revisited the  
issue because I wanted to find a way of experimenting without  
restarting the machine on 10.3.

For reference here is the "official" WO 5.2.2 BROKEN script. The stop  
function will not work with that script. I can repost the fixed one if  
you missed it.

Pierre
--
Pierre Frisch
sPearWay Ltd.
sPearCat Web Catalogs, the flexibility of custom design, the price of a  
package.
http://www.spearcat.com/
======================================================================== 
=============
#!/bin/zsh
#
# 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"

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

     	if [ -e /var/log/webobjects.log ]; then
         	mv /var/log/webobjects.log /var/log/webobjects.log.1
     	fi

		####
		# This set of invocations will launch wotaskd and
		# (optionally) Monitor as root

		"$WOSERVICE" -appPath "$WOTASKD" >/var/log/webobjects.log 2>&1 &

		# Uncomment the next line to start Monitor as root at boot time
		#"$WOSERVICE" -appPath "$WOJAVAMONITOR" -WOPort 56789  
-WOAutoOpenInBrowser NO >>/var/log/webobjects.log 2>&1 &
		####	

		####
		# This set of invocations will launch wotaskd and
		# (optionally) Monitor as 'nonrootuser'
		# Change 'nonrootuser' to whatever account you want wotaskd to run as.
		#
		#/usr/bin/su nonrootuser -c "$WOSERVICE" -appPath "$WOTASKD"  
 >/var/log/webobjects.log 2>&1 &
		#
		#/usr/bin/su nonrootuser -c "$WOSERVICE" -appPath "$WOJAVAMONITOR"  
-WOPort 56789 -WOAutoOpenInBrowser NO >> /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

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

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

		StopPID $parent

		for child in $WOSERVICECHILDPIDS
		{
			StopPID $child
		}

	}
	
}

##
# 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.