# This file controls the behavior of the Vesta startup scripts in
# /etc/init.d.

export PATH=/usr/bin:/usr/sbin:$PATH

# We use vsrun(8) to start the server.

VSRUN_BIN=/usr/sbin/vsrun

# These special users are used to run the servers.

VADMIN_USER=`vgetconfig Repository vadmin_user | sed -e 's/@.*//'`
RUNTOOL_USER=`vgetconfig Repository runtool_user | sed -e 's/@.*//'`

# Where we would like to cd to make sure core files can be written by
# any of the servers shoudl they crash

SERVER_WORK_DIR=`vgetconfig Repository metadata_root`

# Each server has an _BIN variable for its executable, a _NAME
# variable giving its name, and a _VSRUN_ARGS to control how the
# vsrun(8) utility is used to start the server.  The default is to
# send the servers logs to syslog.  A commented out alternative is
# given which will instead use directory of logfiles and also restart
# the server if it crashes.

REPOSITORY_BIN=/usr/sbin/repository
REPOSITORY_NAME=`basename ${REPOSITORY_BIN}`
REPOSITORY_VSRUN_ARGS="--work-dir ${SERVER_WORK_DIR} --syslog ${REPOSITORY_NAME}"
# REPOSITORY_VSRUN_ARGS="--work-dir ${SERVER_WORK_DIR} --logdir /var/log/vesta/${REPOSITORY_NAME} 2m --manager /var/run/${REPOSITORY_NAME}-manager.pid /usr/share/vsrun/examples/termination-handler"

CACHE_BIN=/usr/sbin/VCache
CACHE_NAME=`basename ${CACHE_BIN}`
CACHE_VSRUN_ARGS="--work-dir ${SERVER_WORK_DIR} --syslog ${CACHE_NAME}"
# CACHE_VSRUN_ARGS="--work-dir ${SERVER_WORK_DIR} --logdir /var/log/vesta/${CACHE_NAME} 2m --manager /var/run/${CACHE_NAME}-manager.pid /usr/share/vsrun/examples/termination-handler"

RUNTOOL_BIN=/usr/sbin/RunToolServer
RUNTOOL_NAME=`basename ${RUNTOOL_BIN}`
RUNTOOL_VSRUN_ARGS="--work-dir ${SERVER_WORK_DIR} --syslog ${RUNTOOL_NAME}"
# RUNTOOL_VSRUN_ARGS="--work-dir ${SERVER_WORK_DIR} --logdir /var/log/vesta/${RUNTOOL_NAME} 2m --manager /var/run/${RUNTOOL_NAME}-manager.pid /usr/share/vsrun/examples/termination-handler"

# Uncomment this if you want to increase the number of file
# descriptors available to the servers (notably the repository)

# ulimit -H -n 32768

# Uncomment this if you want to be sure your servers can dump core

# ulimit -c unlimited
