
##############################################################################
# Copyright (c) Members of the EGEE Collaboration. 2009. 
# See http://www.eu-egee.org/partners/ for details on the copyright
# holders.  
# 
# Licensed under the Apache License, Version 2.0 (the "License"); 
# you may not use this file except in compliance with the License. 
# You may obtain a copy of the License at 
# 
#     http://www.apache.org/licenses/LICENSE-2.0 
# 
# Unless required by applicable law or agreed to in writing, software 
# distributed under the License is distributed on an "AS IS" BASIS, 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
# See the License for the specific language governing permissions and 
# limitations under the License.
##############################################################################
#
# NAME :        config_cream_locallogger
#
# DESCRIPTION : This function configures log file rotation.
#
# AUTHORS :     grid-release@infn.it
#
# YAIM MODULE:  glite.yaim.cream-ce
#
##############################################################################

function config_cream_locallogger_check () {

  requires $1 GLITE_USER

}

function config_cream_locallogger_setenv () {

  yaimlog DEBUG "This function currently doesn't set any environment variables."

}

function config_cream_locallogger () {

GLITE_CREAM_LOCATION_VAR=/var
GLITE_CREAM_LOCATION_ETC=/etc

  CREAM_LOCALLOGGER_DIR=${GLITE_CREAM_LOCATION_VAR}/cream_lb
  CREAM_LOCALLOGGER_CONF_FILE=${GLITE_CREAM_LOCATION_ETC}/lb.conf

  mkdir -p ${CREAM_LOCALLOGGER_DIR}
  chown ${GLITE_USER}:${GLITE_USER} ${CREAM_LOCALLOGGER_DIR}
  chmod 755 ${CREAM_LOCALLOGGER_DIR}

  touch ${CREAM_LOCALLOGGER_CONF_FILE}

  cat <<EOF > "${CREAM_LOCALLOGGER_CONF_FILE}"
LL_PIDFILE=${CREAM_LOCALLOGGER_DIR}/glite-lb-logd.pid
IL_PIDFILE=${CREAM_LOCALLOGGER_DIR}/glite-lb-interlogd.pid
EOF

}
