 #!/bin/sh
#
# Start the AOLServer HTTP server.
#

NAME="OpenACS - CVS HEAD Test server"
SERVICEPATH=/usr/local/aolserver/servers/openacs
PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/pgsql/bin
trap "" 1

start()
{

   echo -n "Starting web server: $NAME"
   echo -e -n "\r"

   #!/bin/sh

    #we need to export the library stuff first
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib
    export PATH=$PATH:/usr/local/pgsql/bin


    # give time for Postgres to come up
    sleep 1
    exec /usr/local/aolserver/bin/nsd -it $SERVICEPATH/etc/config.tcl -u openacs -g web &

    # For AOLserver 4 using privileged ports (usually < 1024), add the flag
   # -b youraddress:yourport
    echo ""
}



stop()
{
    echo -n "Stopping web server: $NAME"
    killall nsd
    echo ""
}


case "$1" in

  start)
    start
    ;;

  stop)
    stop
    ;;


  restart)
    stop
    sleep 2
    start
    ;;

  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
    exit 1
    ;;
esac

echo -n -e "\c\r\n"
exit 0 
