All pastes #88010 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-07-14 12:23 UTC
rendered paste body
#!/bin/sh
# Script que verifica o espaço em disco de todas as partição, se o tamando for maior
# que 90%, envia um e-mail ao administrador do sistema.
# Autor: Fábio Becamp
#        <fabio.becamp@virtuallink.com.br>

df -H | grep -vE '^Sist|File' | awk '{ print $5 " " $1 }' | while read output;
do
        echo $output
        size=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
        particao=$(echo $output | awk '{ print $2 }' )
        if [ $size -ge 90 ]; then
                echo "Running out of space \"$particao ($size%)\" on $(hostname) as on $(date)" |
                mail -s "Alerta: Almost out of disk space $size%" suporte@virtuallink.com.br
        fi
done