Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #export maillist=mailxxx@gmail.com
  4. export maillist=mailxxx@gmail.com;
  5. #df -PH | grep -vE '^Filesystem|none|cdrom'|awk '{ print $5 " " $6 }' | while read output;
  6. df -PH | grep -vE '^Filesystem|none|cdrom|swdepot'|awk '{ print $5 " " $6 }' > diskcheck.log;
  7.  
  8. #diskcheck is current output whereas disk_alert is previous runned output
  9.  
  10. if [ -s "$HOME/DBA/monitor/log/disk_alert.log" ]; then
  11. #Getting variables and compare with old
  12. usep=$(awk '{ if($1 > 60) print $0 }' $HOME/DBA/monitor/diskcheck.log | cut -d'%' -f1)
  13. usep1=$(awk '{ if($1 > 60) print $0 }' $HOME/DBA/monitor/log/disk_alert.log | cut -d'%' -f1)
  14. partition=$(cat $HOME/DBA/monitor/diskcheck.log | awk '{ print $2 }' )
  15. else
  16. cat $HOME/DBA/monitor/diskcheck.log > $HOME/DBA/monitor/log/disk_alert.log
  17. fi
  18. **echo $usep;
  19. echo $usep1;**
  20. if [ "$usep" -ge 60 ]; then
  21. if [ "$usep" -eq "$usep1" ]; then
  22. mail=$(awk '{ if("$usep" == "$usep1") print $0 }' $HOME/DBA/monitor/diskcheck.log)
  23. echo "Running out of space "$mail ($usep%)" on $(hostname) as on $(date)" | mail -s "Disk Space Alert: Mount $mail is $usep% Used" $maillist;
  24. fi
  25. fi
  26.  
  27. 66 65 85 66
  28. 66 65 85 66
  29. disk_alert.sh: line 19: [: 66
  30. 65
  31. 85
  32. 66: integer expression expected
  33.  
  34. 66
  35. 65
  36. 85
  37. 66
  38.  
  39. if [ "$usep" -ge 60 ]; then
  40. this condition will pass.
  41.  
  42. usep=$(awk '{ if($1 > 60) print $0 }' $HOME/DBA/monitor/diskcheck.log | cut -d'%' -f1)
  43.  
  44. usep=$(awk '{ if($1 > 60) print $1 }' $HOME/DBA/monitor/diskcheck.log
  45.  
  46. usep1=$(awk '{ if($1 > 60) print $0 }' $HOME/DBA/monitor/log/disk_alert.log | cut -d'%' -f1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement