There are a few more options.  In addition to procautostart, there is also daemontools 
<http://cr.yp.to/daemontools.html>.

I've been using the shell script below on OS X for a while.  I also use STARTUPURL to 
call a TAF that emails me when the app server starts.

- Jeff


#!/bin/sh
#
# watcher.sh
#
# Start the Witango app server if it isn't running.
# If the variable dump file exists, deleted it before
# starting the app server.
#
. /etc/rc.common

/usr/bin/top -w -l 1 | /usr/bin/grep witango >> 
/Applications/Witango/Server/watcher.log

x=`/bin/ps axc | /usr/bin/grep witango`
if /bin/test -z "$x"
then
  ConsoleMessage "watcher.sh: Starting Witango App Server"
  echo "`date` watcher.sh: Starting Witango App Server" >> 
/Applications/Witango/Server/watcher.log
  if /bin/test -e 
/Applications/Witango/Server/configuration/variables.WitangoServer/WitangoServer.dump
  then
    rm 
/Applications/Witango/Server/configuration/variables.WitangoServer/WitangoServer.dump
  fi
  /Library/StartupItems/Witango5/Witango5 start
fi




>The solution that I implemented on Linux should work on OSX... No need to use cron 
>though.
>
>the solution i used is called "procautostart"
>
>I downloaded the source and compiled it.  Since OSX is a flavor of Unix now, you 
>should be able to do the same.
>
>Check out this link, it explaines how the procautostart process works.
>
>http://www.linuxdocs.org/HOWTOs/Process-Monitor-HOWTO-2.html
>
>Once you get procautostart compiled and running on the simple test that they provide, 
>you can do something like this to your start witango script.
>
>#!/bin/bash
>
># Set up environment
>umask 022
>WITANGO_USER=witango ; export WITANGO_USER
>WITANGO_PATH=/usr/local/witango ; export WITANGO_PATH
>WITANGO_CONFIG=$WITANGO_PATH/configuration ; export WITANGO_CONFIG
>JAVA_HOME=/usr/local/j2re1.4.1_03 ; export JAVA_HOME
>
>PATH=$WITANGO_PATH/bin:/bin:/usr/bin ; export PATH
>LD_LIBRARY_PATH=$WITANGO_PATH:$JAVA_HOME/lib/i386/server:$JAVA_HOME/lib/i386/client:$JAVA_HOME/lib/i386:/usr/lib
> ; export LD_LIBRARY_PATH
>CLASSPATH=$WITANGO_PATH/jdbc_drivers/JSQLConnect.jar:$WITANGO_PATH ; export CLASSPATH
>LC_ALL=en_US ; export LC_ALL
>
>cd /usr/local/witango
>
>/sbin/procautostart -n 5 -c "$WITANGO_PATH/witangod -u" nohup &
>
>
>/John
>
>Michael Dittbrenner wrote:
>
>>I was wondering if anyone has and is willing to share code to have the witangod 
>>process restarted after it unexpectedly quits. We just upgraded to witango 5 for mac 
>>and the server seems to quit out, I was in the process of trying to write a shell 
>>script to be called by crontab to see if the process is running if not to start it. 
>>If someone has anything like this and is willing to share I would greatly appreciate 
>>it.
>>
>> 
>>Mike D
>>
>> 
>>****************************************
>>
>>Educational Directories Unlimited, Inc.
>>
>> 
>>Michael Dittbrenner
>>
>>Programmer
>>
>>http://www.StudyAbroad.com <http://www.studyabroad.com/>
>>
>>http://www.GradSchools.com <http://www.gradschools.com/>
>>
>>A service of EDU, Inc... http://www.EDUdirectories.com 
>><http://www.edudirectories.com/>
>>
>>A partner of EDU Internet Strategies: http://www.EDUInternetStrategies.com/ 
>><http://www.eduinternetstrategies.com/>
>>
>> 
>>[Phone]  610-499-9200
>>
>>[Fax]    610-499-9205
>>
>>[E-mail] [EMAIL PROTECTED]  or [EMAIL PROTECTED]

-- 

Jeff Bohmer
VisionLink, Inc.
_________________________________
303.402.0170
www.visionlink.org
_________________________________
People. Tools. Change. Community.
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to