• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[TIP] Application launch script wrapper
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[TIP] Application launch script wrapper


  • Subject: [TIP] Application launch script wrapper
  • From: email@hidden
  • Date: Fri, 2 Sep 2005 15:47:36 +0200


Hi!

When deploying using WOTask/JavaWOMonitor we usually specify the path to the application launch script. WOTask launches this script using the SpawnOfWotaskd.sh script.

This script redirects standard and error output of the application and its launch script to /dev/null. This makes live troubleshooting harder than necessary. For one the output of the launch script is lost. Having this however comes in handy debug an application that refuses to start.

A great tool for debugging applications that hang is to send them a QUIT signal. This makes the JVM write a full thread dump to the error out put. Unfortunately this, by default, is also lost to /dev/null.

I thus wrote another wrapper script to the appliaction launch script. This script redirects all output to a common log file. Rather than replacing SpawnOfWotaskd.sh, I add another layer of indirection by pointing WOTask to my launchApplication.sh script:

#!/bin/sh

APPLICATION_NAME=
COMMAND_LINE_ARGS=

for arg in "$@"
do
        case ${arg} in
                -application=*)        APPLICATION_NAME=`echo ${arg} | cut -d= -f2`
                                ;;
                *)                COMMAND_LINE_ARGS="${COMMAND_LINE_ARGS:+$COMMAND_LINE_ARGS }${arg}"
                                ;;
    esac
done


if [ "${APPLICATION_NAME}" != "" ]
then
        echo WILL LAUNCH $@ >>${LOGDIR}/launchApplication.log
        ${NEXT_ROOT}/Local/Library/WebObjects/Applications/${APPLICATION_NAME}.woa/${APPLICATION_NAME} ${COMMAND_LINE_ARGS} >>${LOGDIR}/launchApplication.log 2>&1
else
        echo APPLICATION NAME NOT FOUND IN $@ >>${LOGDIR}/launchApplication.log
fi

The script needs to figure out the name of the application to launch. I specify this in JavaWOMonitor with an additional argument in the application's configuration:

-application=MyApplication

Now all stdout and stderr output goes to the launchApplication.log file. I rotate this file on a daily basis.

Enjoy!
Pierre ********************************************************************** This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender of this message. (email@hidden) This email message has been checked for the presence of computer viruses; however this protection does not ensure this message is virus free. Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu **********************************************************************
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [TIP] Application launch script wrapper
      • From: Geoff Hopson <email@hidden>
  • Prev by Date: Re: Any JavaScript Experts?
  • Next by Date: Re: [TIP] Application launch script wrapper
  • Previous by thread: Re: Any JavaScript Experts?
  • Next by thread: Re: [TIP] Application launch script wrapper
  • Index(es):
    • Date
    • Thread