#! /bin/sh #! /bin/ksh #! /bin/bash # $Id$ # # This script is written by Olaf Kaus # Copyright (c) 2000 Maxpert AG. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Public Licence. quarantine_dir=/var/spool/mailscanner/quarantine safetime=8 age () { datum=$1 result=0 year=$( echo $datum | cut -c 1-4 | sed 's/^0*//' ) mon=$( echo $datum | cut -c 5-6 | sed 's/^0*//' ) day=$( echo $datum | cut -c 7-8 | sed 's/^0*//' ) result=$( expr $year '*' 12 '+' $mon ) result=$( expr $result '*' 31 '+' $day ) echo $result } today=$( age $( date +'%Y%m%d' ) ) ( cd $quarantine_dir for i in $( ls ) do bordertime=$( expr $(age $i) + "$safetime" ) if [ $bordertime -lt $today ] then rm -rf $quarantine_dir/$i #echo rm -rf $quarantine_dir/$i fi done ) #EOF