On Wed, 24 Mar 2004 07:41:22 +0100
J-C Hendrickx <[EMAIL PROTECTED]> wrote:

> Bonjour,
Bonjour

> Pourrais-tu me donner un petit exemple du test dans la
> crontab ?

#!/bin/sh

#   -C     Check the current IDE power mode status
#Cf man hdparm
ETAT=$(hdparm -C /dev/hdc | tail -n1 | cut -d ' ' -f6)
#le reste sert � extraire "standby" ou 
#"active/idle" 

#/mnt/broll est le pt de montage du disque
#Ici le cut est juste l� pour faire joli ;)
IF_MOUNT=$(grep "/mnt/broll" /proc/mounts | cut -d " " -f2)

##### le test
#      LE DISQUE TOURNE     ET  IL N'EST PAS MONT�    
if [ "$ETAT" != "standby" ] && [ -z $IF_MOUNT ]
then
        /sbin/hdparm -y /dev/hdc > /dev/null 2>&1
fi
## fin du test et du fichier ##############

"/dev/null 2>&1" C'est pour �viter de recevoir un courriel � chaque 
ex�cution du script

A enregistrer par ex dans :
/root/scripts/hdstop.sh

Avec la commande:
~# crontab -e -u root

Ajouter par ex ceci dans la crontab de root:

* * * * * /root/scripts/hdstop.sh >& /dev/null

L� c'est toutes les min.

@+

Beno�t

Ps.
Si je n'ai pas �t� clair, ce qui ne m'�tonnerais pas! ;)
[EMAIL PROTECTED]
_______________________________________________________
Linux Mailing List - http://www.unixtech.be
Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux
Archives: http://www.mail-archive.com/[EMAIL PROTECTED]
IRC: chat.unixtech.be:6667 - #unixtech

Répondre à