# cd ~
# mkdir WO523
# cd WO523
# pico StartupParameters.plist
Begin copying below this line.
{
Description = "WebObjects Services";
Provides = ("WebObjects Services");
Requires = ("Disks", "Network");
OrderPreference = "Last";
Messages =
{
start = "Starting WebObjects Services";
stop = "Stopping WebObjects Services";
};
}
# pico WebObjects
Begin copying below this line.
#!/bin/sh
#
# 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. This is less secure than
# starting as 'appserver'
"$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 &
####
####
# OSX Server now has the 'appserver' and 'appserveradm'
# It is recommended that apps be started as the 'appserver'
# instead of 'root'
#
#/usr/bin/su appserver -c "$WOSERVICE -appPath $WOTASKD" > \\
#/var/log/webobjects.log 2>&1 &
#
#/usr/bin/su appserver -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
WOSERVICEPIDS=`$PS -jaxwwwww | $GREP "$WOSERVICE" | \\
$GREP -v grep | $AWK '{print $2}'`
parents=""
children=""
for parent in $WOSERVICEPIDS
{
WOSERVICECHILDPIDS=`$PS -jaxwwwww | \\
$AWK 'NF>3 {if ( $3 =='"$parent"' ) print $2}'`
parents="$parents $parent"
for child in $WOSERVICECHILDPIDS
{
children="$children $child"
}
}
#kill them all at once
kill $parents $children
}
##
# Restart WebObjects Services
##
RestartService ()
{
ConsoleMessage "Restarting WebObjects services"
PRINTSTARTSTOPMESSAGES="NO"
StopService
StartService
}
##
# Stop Process by PID
##
StopPID ()
{
`kill "$1"`
}
RunService "$1"
# cd /System/Library/StartupItems/WebObjects
# sudo mv ~/WO523/StartupParameters.plist .
# sudo mv ~/WO523/WebObjects .
# sudo chown root:wheel StartupParameters.plist WebObjects
# sudo chmod 644 StartupParameters.plist
# sudo chmod 755 WebObjects
# sh -n WebObjects
# sudo SystemStarter start "WebObjects Services"