info:cherchergrosfichiersetnotifier

#! /bin/bash
# Usage:
# checkGrosFichiers.sh
# chercher les gros consommateurs de memoire sur un disque
# Required: ls, find
# FR, fradeff@akademia.ch, www.unige.ch
# History 2 octobre 2008, created FR
############
#definition variables
#repertoire racine a fouiller
racine=racine/sous.repertoire #without root slash and ending slash

rapport=w3
#exportation des resultats
resultats=/home/xxx/putz
#notification
notification="truc@chose.ch toto@gmail.com"
############
#debut du programme
############
#explore racine et genere rapport
du -sh /$racine/* > /home/xxx/putz/utilisation_$rapport
#analyse du rapport
#recherche Go
cat /home/xxx/putz/utilisation_$rapport |  egrep '(^.*G)' | sed 's|\,\([0-9]\)G|\100M|g' | sed 's|\([0-9]\)G|\1000M|g' | sed 's|^ *||g' > /home/xxx/putz/tmp
cat /home/xxx/putz/utilisation_$rapport |  egrep '(^.*M)' | sed 's|^ *||g' >> /home/xxx/putz/tmp
cat /home/xxx/putz/tmp | sort -nr > /home/radeff/putz/utilisation_$rapport

#notification par email
cat /home/xxx/putz/utilisation_$rapport | mailx -s "utilisation sur serveur xxx espace /blabla" $notification
#
  • info/cherchergrosfichiersetnotifier.txt
  • Dernière modification : 2018/07/18 09:45
  • de radeff