1 Reply Latest reply on Dec 16, 2010 1:23 PM by Dude!

    Shell script error

    RK
      Hi ,

      I have run the bleow script on Linux but i got the error , can u pls tell me the correct script.

      #!/bin/sh

      # variables
      ALERT=90

      # process device list
      df -H | while read FS SIZE USED AVAIL USEDPCT MOUNTED
      do
      # skip the entries that are not of interest or not valid
      [ "$FS" = "none" ] && continue
      [ "$FS" = "Filesystem" ] && continue

      # this is what we see as a valid device
      echo "$FS has $SIZE, of which $AVAIL is available"

      # remove the % char from the USEDPCT variable
      PCTFREE=`echo $USEDPCT`

      # now check whether the device is exceeding the alert level
      if [ $PCTFREE -ge $ALERT ]; then
      echo "Mount point $MOUNTED is at $USEDPCT and exceeds limits"
      mailx -s 'Alert:WPABETA disk space' <mail id>
      fi
      done

      #eof

      */dev/mapper/VolGroup00-LogVol00 has , of which is available*
      *./check_fs.sh: line 20: [: -ge: unary operator expected*
      *34G has 23G, of which 70% is available*
      *./check_fs.sh: line 20: [: /: integer expression expected*
      */dev/cciss/c0d0p1 has 105M, of which 41M is available*
      *./check_fs.sh: line 20: [: 62%: integer expression expected*
      */dev/mapper/OracleVG-orcl_lvol has , of which is available*
      *./check_fs.sh: line 20: [: -ge: unary operator expected*
      *11G has 7.9G, of which 79% is available*
      *./check_fs.sh: line 20: [: /u01: integer expression expected*
      */dev/mapper/DataBaseVG-db_lvol has , of which is available*
      *./check_fs.sh: line 20: [: -ge: unary operator expected*
      *96G has 72G, of which 80% is available*
      *./check_fs.sh: line 20: [: /db01: integer expression expected*
      */dev/mapper/FlashVG-flash_lvol has , of which is available*
      *./check_fs.sh: line 20: [: -ge: unary operator expected*
      *22G has 13G, of which 64% is available*
      *./check_fs.sh: line 20: [: /db01/flash_recovery_area: integer expression expected*
      */dev/mapper/TempVG-temp_lvol has , of which is available*
      *./check_fs.sh: line 20: [: -ge: unary operator expected*
      *22G has 80M, of which 1% is available*
      *./check_fs.sh: line 20: [: /db01/temp: integer expression expected*