thanks
thank you so much...
with this post i learn the power of xargs....
i make an script and maybe could be useful for you...
itīs checks the size of the directory and if pass the limit, then check the oldest file and delete it...
This procces is in a loop.... when the spaces fit the limits that you previusly input, the scripts stops...
here is the code:
#bin/bash
#valor 0 es ok
#valor 1 es demasiado grande
. /arwebmin/variables/variables.conf
estado=0
LIMIT=1
limite=$syslogsize
while [ "$estado" -lt "$LIMIT" ]
do
size=`du $dir_incoming | cut -f 1`
echo "$size"
if [ $size -ge $espacio_maximo ] ; then
echo "es mayor"
echo "borrando: $dir_incoming$archivo"
ls -tb $dir_incoming | tail -1 | xargs rm -f
else
echo "es menor"
estado="1"
fi
done
---------------------------------
regards!.
|