#!/usr/bin/bash

# init function for the BDII service publisher, to export some variables

# 29/09/2012: Updated to reflect the EMI locations etc

# The first two can be overridden by external definitions of the variables,
# e.g. if the advertised host name should be an alias
# BDII_CONF=${BDII_CONF:-/opt/bdii/etc/bdii.conf}
BDII_CONF=${BDII_CONF:-/etc/bdii/bdii.conf}
BDII_HOST=${BDII_HOST:-$(hostname -f)}

# Default values - normally overridden by bdii.conf
# BDII_PORT_READ=2170
BDII_PORT=2170
BDII_BIND=o=grid
# BDII_DIR=/opt/bdii
BDII_DIR=/usr
BDII_UPDATE_LDIF="http://grid-monitoring.cern.ch/myegi/sam-pi/status_of_service_in_profile?vo_name=cms&profile_name=CMS_BLACKLIST&output=xml"
# BDII_PID_FILE=${BDII_PID_FILE:-/var/run/bdii-update.pid}
BDII_PID_FILE=${BDII_PID_FILE:-/var/run/bdii/bdii-update.pid}

# NB The bdii.conf file is normally only readable by the bdii user,
# but that should be OK when this is run by the info provider
if [ -r "$BDII_CONF" ]; then
	. "$BDII_CONF"
fi

# Write to stdout - will be imported by the info provider
# echo BDII_PORT_READ=$BDII_PORT_READ
echo BDII_PORT_READ="$BDII_PORT"
echo BDII_BIND="$BDII_BIND"
echo BDII_DIR="$BDII_DIR"
echo BDII_UPDATE_LDIF="$BDII_UPDATE_LDIF"
echo BDII_HOST="$BDII_HOST"
echo BDII_PID_FILE="$BDII_PID_FILE"
