loranloran

vérifier si un fichier a été modifié

Aug 22nd, 2014
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | None | 0 0
  1. Exemple pour un fichier "checkrobots.sh" qui doit vérifier si /home/public_html/robots.txt a changé durant la dernière heure
  2.  
  3. #!/bin/bash
  4. [[ -z `find /home/public_html/robots.txt -mmin -60` ]]
  5. if [ $? -eq 0 ]
  6. then
  7.     echo -e "aucun changement"
  8. else
  9.     mail -s "Le fichier a été changé" email@example.com
  10. fi
  11.  
  12.  
  13.  
  14. puis ensuite tu mets dans le CRON, avec par exemple un check toutes les heures :
  15.  
  16. 01 * * * * /path/to/checkrobots.sh
Advertisement
Add Comment
Please, Sign In to add comment