Bonjour, je fais un script qui envoi un mail lorsque il y a un shutdown dans un fichier de log. Mais je n'arrive pas à trouver une fonction qui regarde si mon fichier est vide.Si il est vide, on n'envoie pas d'e-mail.
Voilà, mon code, ma boucle ne fonctionne pas et je ne vois pas pourquoi, si vous pouviez m'éclairer, merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 #!/bin/bash echo "From: Root@localhost" > /scripts/mailxen.txt | echo "To: jtaquet@etudiant.univ-lr.fr" >>/scripts/mailxen.txt | echo "Subject: Notification Xen" >>/scripts/mailxen.txt | tail -n 2 /var/log/xen/xend.log | grep "shutdown" >>/scripts/mailxen.txt read /scripts/mailxen.txt if [! -s /scripts/mailxen.txt]; then cat /scripts/mailxen.txt | sendmail -F'root' -f'bebert_lambert@hotmail.com' jtaquet@etudiant.univ-lr.fr fi
Partager