#!/bin/bash

# Copyright (C) 2012 NTT DATA Corporation
#
# This program is free software; you can redistribute it and/or
# Modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details

#
# This file should be copied to '/etc/cron.daily/'
# Use "cp -p" command.
#

LOGFILE_DAYS=31

source /opt/hinemos/hinemos.cfg
find ${HINEMOS_LOG_DIR}/ \( \
                         -name 'boot.log.*' -o \
                         -name 'hinemos_manager.log.*' -o \
                         -name 'hinemos_operation.log.*' -o \
                         -name 'hinemos_internal.log.*' -o \
                         -name 'postgresql.log.*' -o \
                         -name 'gc.log.*' -o \
                         -name 'hinemos_manager_summary.*' -o \
                         -name 'jvm_stdout.log.*' \) \
                       -mtime +$LOGFILE_DAYS \
                       -print0 \
    | xargs --no-run-if-empty -0 rm
