On Tue, 12 Dec 2000, hatim wrote:

> je souhaiterais juste que si un utilisateur depasse son quota , qu il soit
> prevenu par mail (dont je preciserais le contenu) et le webmaster aussi

Oh, on peut mettre un quota hard bien plus grand que le quota soft (ou pas
de quota hard du tout), et faire un script de monitoring, dans les
eaux de:

bash-2.01# crontab -l | grep quota
15 01 * * *       /root/bin/monitor_quota.sh

#! /bin/sh

if [ $# = 1 ]; then
   if [ "$1" = "-v" ]; then
      VIEW_ALL=-v
   else
      echo "$0 [-v]"
      echo "$0: bad args."
      exit 2
   fi
else
   if [ $# = 0 ]; then
      VIEW_ALL=-q
   else
      echo "$0 [-v]"
      echo "$0: bad args."
      exit 2
   fi
fi

awk -F: '{print $1}' < /etc/group |
   (while :
    do
       read line
       if [ $? != 0 ]; then
          break
       fi
       quota $VIEW_ALL -g $line
       if [ $? != 0 ]; then
          if [ "$VIEW_ALL" = "-q" ]; then
             quota -v -g $line2
          fi
       fi
    done)

awk -F: '{print $1}' < /etc/passwd |
   (while :
    do
       read line
       if [ $? != 0 ]; then
          break
       fi
       quota $VIEW_ALL $line
       if [ $? != 0 ]; then
          if [ "$VIEW_ALL" = "-q" ]; then
             quota -v $line
          fi
       fi
    done)

Enfin c'est assez effrayant, mais ça a marché de nombreuses années.
Cela envoie le warning à root (pour les user et group quota), pas à
l'utilisateur / groupe concerné.


--
http://www-internal.alphanet.ch/linux-leman/ avant de poser
une question.

Répondre à