#!/bin/bash # # Copyright (C) 2009 Google Inc. # # 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; either version 2 of the License, or # (at your option) any later version. # # 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. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. set -e DATA_DIR=@LOCALSTATEDIR@/lib/ganeti QUEUE_ARCHIVE_DIR=$DATA_DIR/queue/archive # Define how many days archived jobs should be left alone REMOVE_AFTER=21 # Exit if machine is not part of a cluster [[ -e $DATA_DIR/ssconf_master_node ]] || exit 0 # Exit if queue archive directory doesn't exist [[ -d $QUEUE_ARCHIVE_DIR ]] || exit 0 # Remove old jobs find $QUEUE_ARCHIVE_DIR -mindepth 2 -type f -mtime +$REMOVE_AFTER -print0 | \ xargs -r0 rm -f exit 0