Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- email="root@localhost"
- typeset -i error="90"
- if [ -e temp.txt ]; then
- rm temp.txt
- fi
- for disc in `mount| egrep '^/dev' | egrep -iv 'cdrom|proc|sys|pts' |awk '{print $3}'`
- do
- typeset -i uzyciedysku=`df -h $disc|cut -c40-42|grep -i [^a-z]`
- if [ "$uzyciedysku" -ge "$error" ]; then
- echo "Stan uzycia dysku $disc wynosi $uzyciedysku%" >> tmp.txt
- fi
- done
- if [ -e temp.txt ]; then
- message=`cat temp.txt`
- fi
- if [ ${#message} -gt 0 ]; then
- cat tmp.txt | mail -s "Uzycie dysku przekroczylo pewien poziom na maszynie: $HOSTNAME" $email
- fi
Add Comment
Please, Sign In to add comment