Guest User

Untitled

a guest
Jul 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #!/bin/bash
  2. email="root@localhost"
  3. typeset -i error="90"
  4. if [ -e temp.txt ]; then
  5. rm temp.txt
  6. fi
  7. for disc in `mount| egrep '^/dev' | egrep -iv 'cdrom|proc|sys|pts' |awk '{print $3}'`
  8. do
  9. typeset -i uzyciedysku=`df -h $disc|cut -c40-42|grep -i [^a-z]`
  10. if [ "$uzyciedysku" -ge "$error" ]; then
  11. echo "Stan uzycia dysku $disc wynosi $uzyciedysku%" >> tmp.txt
  12. fi
  13. done
  14. if [ -e temp.txt ]; then
  15. message=`cat temp.txt`
  16. fi
  17. if [ ${#message} -gt 0 ]; then
  18. cat tmp.txt | mail -s "Uzycie dysku przekroczylo pewien poziom na maszynie: $HOSTNAME" $email
  19. fi
Add Comment
Please, Sign In to add comment