On 17:14 Mon 09 Aug     , Chris McAvoy wrote:
> Hi All,
> 
> I hope this isn't something that's asked constantly...
> 
> What's the best way to start a Webware app in the background?  I'm a fan 
> (conceptually) of starting it in a screen session, and then detaching.  
> However, over time, it looks like this hangs the app.  Anyone seen this 
> behavior before?
> 
> As far as I know, if you nohup Appserver&, you're good to go.
> 
> Any comments?
> 
> Chris

Chris

I have used Monit to check on the app server processes and start them if
they're not running. For each Webware user or application instance I add a
section like this in ~/.monitrc:

--begin--
check journal-webkit with pidfile /var/www/localhost/htdocs/journal/appserverpid.txt
  start program = "/var/www/localhost/htdocs/journal/webkit start"
  stop program = "/var/www/localhost/htdocs/journal/webkit stop"
  if failed host 127.0.0.1 port 8002 type tcp then restart
  if 3 restarts within 5 cycles then timeout
--end-

In this example port 8002 must match the port that each useer is set up with in 
your Apache config. This is the webkit script that I'm using:

--begin--
#! /bin/sh

# get the path of the directory the this script resides in.
# (it should be stored in the appdir, with a symlink to /etc/init.d/appname
#  if it is installed as a system daemon)

appdir=`readlink -f $0`
appdir=`dirname $appdir`
appname=`basename $0`
UNIXUSER=journal

case "$1" in
  start)
    echo -n "Starting $appname: "
    if [ "$USER" != "$UNIXUSER" ]; then
        su $UNIXUSER -c "cd $appdir && ./AppServer &>appserver.log &"
    else
        cd $appdir && ./AppServer &>appserver.log &
    fi
    echo "done."
    ;;
  stop)
    echo -n "Stopping $appname: "
    kill `cat $appdir/appserverpid.txt`
    echo "done."
      ;;
  restart)
    $0 stop
    sleep 2
    $0 start
    echo "done."
    ;;

  kill)
    echo -n "Killing $appname: "
    kill -9 `cat $appdir/appserverpid.txt`
    echo "done."
      ;;
  *)
    echo "Usage: /etc/init.d/$0 {start|stop|restart}"
    exit 1
    ;;
esac
--end--

Eric Radman  |  http://eradman.com


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to