Check-partition : Différence entre versions
| Ligne 16 : | Ligne 16 : | ||
fi | fi | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| + | [[Catégorie:Scripts System]] | ||
Version actuelle datée du 29 avril 2014 à 16:29
Ce script permet de vérifier l'espace disque restant d'une partition et d'envoyer un mail si le seuil défini est atteint
#!/bin/bash
#start editing
mail="user@mail.com"
partition="/dev/sda1"
threshold="90"
#stop editing
percent=$(df -h / | grep "$partition" | awk '{ print $5 }' | sed 's/%//g')
if ((percent > threshold))
then
echo "$partition at $(hostname -f) is nearly full" | mail -s "Your disk is nearly full!!!" "$mail"
fi