Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #export maillist=mailxxx@gmail.com
- export maillist=mailxxx@gmail.com;
- #df -PH | grep -vE '^Filesystem|none|cdrom'|awk '{ print $5 " " $6 }' | while read output;
- df -PH | grep -vE '^Filesystem|none|cdrom|swdepot'|awk '{ print $5 " " $6 }' > diskcheck.log;
- #diskcheck is current output whereas disk_alert is previous runned output
- if [ -s "$HOME/DBA/monitor/log/disk_alert.log" ]; then
- #Getting variables and compare with old
- usep=$(awk '{ if($1 > 60) print $0 }' $HOME/DBA/monitor/diskcheck.log | cut -d'%' -f1)
- usep1=$(awk '{ if($1 > 60) print $0 }' $HOME/DBA/monitor/log/disk_alert.log | cut -d'%' -f1)
- partition=$(cat $HOME/DBA/monitor/diskcheck.log | awk '{ print $2 }' )
- else
- cat $HOME/DBA/monitor/diskcheck.log > $HOME/DBA/monitor/log/disk_alert.log
- fi
- **echo $usep;
- echo $usep1;**
- if [ "$usep" -ge 60 ]; then
- if [ "$usep" -eq "$usep1" ]; then
- mail=$(awk '{ if("$usep" == "$usep1") print $0 }' $HOME/DBA/monitor/diskcheck.log)
- echo "Running out of space "$mail ($usep%)" on $(hostname) as on $(date)" | mail -s "Disk Space Alert: Mount $mail is $usep% Used" $maillist;
- fi
- fi
- 66 65 85 66
- 66 65 85 66
- disk_alert.sh: line 19: [: 66
- 65
- 85
- 66: integer expression expected
- 66
- 65
- 85
- 66
- if [ "$usep" -ge 60 ]; then
- this condition will pass.
- usep=$(awk '{ if($1 > 60) print $0 }' $HOME/DBA/monitor/diskcheck.log | cut -d'%' -f1)
- usep=$(awk '{ if($1 > 60) print $1 }' $HOME/DBA/monitor/diskcheck.log
- 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