User Tools

Site Tools


scripts

This is an old revision of the document!


Server administration

#! /bin/sh
 
for ip in echo `awk '{print $NF}' /var/log/fail2ban.log | 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.1363007707.txt.gz · Last modified: 2013/03/11 14:15 by cedric