Forum OpenACS Development: Re: wanted to share my run script (for use with daemontools)

Collapse
Posted by Jim Lynch on
#!/bin/sh

# aolserver4 recommends descriptors limit (FD_SETSIZE) to be set to 1024,
# which is standard for most OS distributions

# setup instructions: set the variables NSHOME to your aolserver prefix,
# set SERVER to the name of your service
# NSD_USER and NSD_GROUP to the user and group you want
# the web server to run as (note, the default setting assumes you have
# a user named the same as the service, and the web server runs as that user)
# SERVERS_PREFIX set to the dir containing all the services
# I happen to like /web, others like /var/lib/aolserver
# SERVER_ROOT to the dir containing your service
# (shouldn't have to change SERVER_ROOT)
# PG_CONFIG to the location of postgres's pg_config executable
# (on debian, this is in one of the -dev packages; if you built pg, you
# should find it in (pg prefix)/bin)
# PGPORT to the port the postgres you want to use is listening to

# For freebsd systems, uncomment following line:
# ulimit -n 1024

NSHOME=/acshome/mu-dev/inst

SERVER=mu-dev
NSD_USER=${SERVER}
NSD_GROUP=${SERVER}

SERVERS_PREFIX=/web
SERVER_ROOT=${SERVERS_PREFIX}/${SERVER}

PG_CONFIG=/usr/lib/postgresql/8.3/bin/pg_config

export PGPORT=5434

# beyond this point, probably you won't need to change... AND if you do,
# please let me (jiml) know by posting to this thread:
# https://openacs.org/forums/message-view?message_id=4006917

export LD_LIBRARY_PATH=${NSHOME}/lib:$($PG_CONFIG --pkglibdir)

# give time for Postgres to come up
# see https://openacs.org/forums/message-view?message_id=176100
sleep 4

exec \
${NSHOME}/bin/nsd \
-i \
-t ${SERVER_ROOT}/etc/config.tcl \
-u ${NSD_USER} \
-g ${NSD_GROUP}

# For AOLserver 4 using privileged ports (usually < 1024), add the flag
# -b youraddress:yourport to the nsd command