#!/bin/sh

###############################################################################
#
#   Copyright (c) 2006 Zenoss, Inc. all rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
###############################################################################

#
# This script cleans up the temporary files in the renderserver as
# well as executes the zenbackup.py script, resulting in a database
# backup file being created.
#

# location of the shell script that initializes the zenoss environment
ZENOSS_ENV=~zenoss/.bashrc


# print the error message passed and exit with a return code of 1 (error)
fail() {
    echo $*
    exit 1
}


#
# main script starts here
#

# set up the environment
test -f ${ZENOSS_ENV} || fail "Source environment not found"
. ${ZENOSS_ENV}


# delete the renderserver files.  they grow a LOT over time
find /tmp/renderserver -name \*.png -exec rm '{}' \;


# run zenbackup to dump the events database as well as zeodb
#${ZENHOME}/bin/zenbackup -C ${ZENHOME}/etc/zenbackup.conf < /dev/null


