gacanepa

servicios.sh

Dec 7th, 2012
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. cd /etc/init.d
  3. echo "*******************************************************************" > mail.txt
  4. echo Estado de los servicios del sistema - $(date) >> mail.txt
  5. echo "*******************************************************************" >> mail.txt
  6. echo Equipo: $HOSTNAME >> mail.txt
  7. echo "*******************************************************************" >> mail.txt
  8. for i in $(ls /etc/init.d)
  9. do
  10. if ps aux | grep -v grep | grep $i > /dev/null
  11. then
  12. echo $i ACTIVO >> mail.txt
  13. else
  14. echo $i CAIDO >> mail.txt
  15. fi
  16. done
  17. mail fulano@gmail.com -s "Estado de los servicios" < mail.txt
RAW Paste Data