#!/bin/sh
#scavara -21.04.2011.
#what this *should* do is check bacula db for all media volumes marked as purged
#using bconsole
#and then check if coresponding files still exist on the disk and then delete them
#
DIR="/whereeverzyour/clients/dir/is"
ALLCLIENTS=(`ls $DIR/`)
#you might want to exclude some clients from this check
EXCLUDECLIENTS=('client1 client2.domain.com')
cnt=0
for j in ${EXCLUDECLIENTS[@]}
do
ALLCLIENTS=(${ALLCLIENTS[@]/$j})
CLIENTS=(${ALLCLIENTS[@]})
done
for i in ${CLIENTS[@]}
do
for x in `echo "list media pool=$i-pool" | bconsole | awk -F '|' '/Purged/ {print $3}' | sed 's/ //g'`
do
if [ -e $DIR/$i/$x ]; then
echo deleting "$DIR/$i/$x"
ls $DIR/$i/$x
(( cnt ++ ))
else
echo "file doesn'exist..anymore: $x"
fi
done
done
cntingb=$((2 * $cnt))
echo "Total deleted files: $cnt ( $cntingb GB freed)"</pre></pre></pre>
22.4.11
bacula script....
| Reactions: |
Subscribe to:
Post Comments (Atom)




0 comments:
Post a Comment