Petit Probleme Script
bichoking
Messages postés
89
Statut
Membre
-
bichoking Messages postés 89 Statut Membre -
bichoking Messages postés 89 Statut Membre -
Bonjour,
J'ai besoin de votre aide, car en faite j'ai écrit un script, mais ce scripte ne s'effectue pas correctement.
Le voici :
#!/bin/bash
system=`hostname`
for line in `df -aPh | grep "^/" | grep \% | sort | awk '{print$6"-"$5"-"$4}'`; do
percent=`echo "$line" | awk -F - '{print$2}' | cut -d % -f 1`
partition=`echo "$line" | awk -F - '{print$1}' | cut -d % -f 1`
limit=80
if [ $partition == '/' ] && [ $percent > $limit ] ; then
echo "Votre partition $partition atteint $percent %" > Logs/Partition1.txt
fi
if [ $partition == '/dev/shm' ] && [ $percent > $limit ] ; then
echo "Votre partition $partition atteint $percent %" > Logs/Partition2.txt
fi
if [ $partition == '/home' ] && [ $percent > $limit ] ; then
echo "Votre partition $partition atteint $percent %" > Logs/Partition3.txt
fi
if [ $partition == '/center' ] && [ $percent > $limit ] ; then
echo "Votre partition $partition atteint $percent %" > Logs/Partition4.txt
fi
done
Le probleme est que meme si le pourcentage de la partition est inférieur a la limite, le fichier Partiiton2, ou 3, ou 4 , sécrit quand même. Je ne sais pas ou se trouve mon erreur.
Merci de votre aide.
J'ai besoin de votre aide, car en faite j'ai écrit un script, mais ce scripte ne s'effectue pas correctement.
Le voici :
#!/bin/bash
system=`hostname`
for line in `df -aPh | grep "^/" | grep \% | sort | awk '{print$6"-"$5"-"$4}'`; do
percent=`echo "$line" | awk -F - '{print$2}' | cut -d % -f 1`
partition=`echo "$line" | awk -F - '{print$1}' | cut -d % -f 1`
limit=80
if [ $partition == '/' ] && [ $percent > $limit ] ; then
echo "Votre partition $partition atteint $percent %" > Logs/Partition1.txt
fi
if [ $partition == '/dev/shm' ] && [ $percent > $limit ] ; then
echo "Votre partition $partition atteint $percent %" > Logs/Partition2.txt
fi
if [ $partition == '/home' ] && [ $percent > $limit ] ; then
echo "Votre partition $partition atteint $percent %" > Logs/Partition3.txt
fi
if [ $partition == '/center' ] && [ $percent > $limit ] ; then
echo "Votre partition $partition atteint $percent %" > Logs/Partition4.txt
fi
done
Le probleme est que meme si le pourcentage de la partition est inférieur a la limite, le fichier Partiiton2, ou 3, ou 4 , sécrit quand même. Je ne sais pas ou se trouve mon erreur.
Merci de votre aide.
A voir également:
- Petit Probleme Script
- Script vidéo youtube - Guide
- Ghost script - Télécharger - Polices de caractères
- Trier du plus petit au plus grand excel - Guide
- Petit 2 ✓ - Forum Windows
- Mas script - Accueil - Windows