Child pages
  • Deploying on Linux

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
#!/bin/bash

# chkconfig: - 90 20
# description: Provides WebObjects services

# Source function library.
. /etc/rc.d/init.d/functions

NEXT_ROOT="/opt"
export NEXT_ROOT

PATH="/bin:/usr/bin:/usr/java/jdk1.5/bin"
export PATH

USER=appserver

# See how we were called.
case "$1" in
	start)
		echo -n "Starting wotaskd and Monitor: "
		su $USER -c "$NEXT_ROOT/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 &"
		su $USER -c "$NEXT_ROOT/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &"
		echo
		;;
	stop)
		echo -n "Shutting down wotaskd and Monitor: "
		WOTASKD_PID=`ps aux | awk '/WOPort 1085/ && !/awk/ {print $2}'`
		kill $WOTASKD_PID
		MONITOR_PID=`ps aux | awk '/WOPort 56789/ && !/awk/ {print $2}'`
		kill $MONITOR_PID
		echo
		;;
	restart)
		$0 stop
		$0 start
		;;
	*)
		echo -n "Usage: $0 {start|stop|restart}"
		exit 1
esac

if [ $# -gt 1 ]; then
	shift
	$0 $*
fi

exit 0

Save the script as /etc/init.d/webobjects

You also need to add the script with chkconfig so that everything start up after a reboot. If you named the above script as "webobjects", do :

For CentOS, RedHat or Fedora distributions :

...