scripts
Server administration
#! /bin/sh for ip in echo `grep Ban /var/log/fail2ban.log | awk '{print $NF}' | sort | uniq` do for email in `whois $ip | perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}' | sort | uniq` do echo "Sending email to $email ..." echo "Hi, The IP $ip has just been banned. Here are more information about $ip: `whois $ip` Regards," | mail -s "$ip banned" $email; done done
apt and dpkg
dpkg -l |awk '/^rc/ {print $2}' | xargs sudo dpkg --purge
scripts.txt · Last modified: 2013/03/11 14:32 by cedric