Big Brother Remove Host from Config and History Script
#!/bin/bash
if [ $# -ne 1 ]; then
echo Usage: $0 hostname
exit 127
fi
find ~bb/bbvar/hist -name "*$1,*" -exec ls -al {} ;
find ~bb/bbvar/logs -name "*$1,*" -exec ls -al {} ;
find ~bb/bigbrother/ext/bb-central/tmp -name "*$1*" -exec ls -al {} ;
find ~bb/bigbrother/tmp -name "*$1*" -exec ls -al {} ;
find ~bb/bbvar/hist -name "*$1,*" -exec rm -rf {} ;
find ~bb/bbvar/logs -name "*$1,*" -exec rm -rf {} ;
find ~bb/bbvar/histlogs -name "*$1_*" -exec rm -rf {} ;
find ~bb/bigbrother/ext/bb-central/tmp -name "*$1*" -exec rm -rf {} ;
find ~bb/bigbrother/tmp -name "*$1*" -exec rm -rf {} ;
cp ~bb/bigbrother/etc/bb-hosts ~bb/bigbrother/etc/bb-hosts.clean
find ~bb -name bb-hosts | xargs sed "/$1*/d" > cleanbbhosts
mv cleanbbhosts ~bb/bigbrother/etc/bb-hosts
echo "Host $1 has been removed"
exit
No comments:
Post a Comment