#!/bin/sh # otrs.cleanup - to cleanup not proccesed emails # Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/ # -- # $Id: otrs.cleanup,v 1.3 2006/11/02 12:20:59 tr Exp $ # -- # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -- #OTRS_ROOT=/usr/local/otrs OTRS_ROOT=$HOME OTRS_SPOOLDIR=$OTRS_ROOT/var/spool OTRS_POSTMASTER=$OTRS_ROOT/bin/PostMaster.pl if ! test -e $OTRS_ROOT/RELEASE; then echo "$HOME is not OTRS root!" exit 1; fi # check otrs spool dir echo " Checking otrs spool dir... " for i in $OTRS_SPOOLDIR/* ; do # process old emails if echo $i | grep -v '*' >> /dev/null; then echo -n " Starting otrs PostMaster... ($i) " if cat $i | $OTRS_POSTMASTER >> /dev/null 2>&1; then rm $i && echo "(remove email) done."; else echo "failed."; fi fi done echo " done."