The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Script fails
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-09-2006
JStone JStone is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 15
Script fails

Hi,

I am trying to install a package on solaris and one of the packaging scripts fail unexpectedly. There is a script called "checkinstall" which checks for the /opt space and aborts the installation if /opt is less than 100MB. In my case, even if /opt has enoguh space, the script fails.

This is my script

REQUIRED_SAPCE="100000"
AVAILABLE_SPACE=`df -k /opt | grep -v "avail" | awk '{print $4}'`
if [ "$AVAILABLE_SPACE" -lt "$REQUIRED_SPACE" ]
then
echo "Space available in /opt is ${AVAILABLE_SPACE}KB. ${REQUIRED_SPACE}KB required"
exit 1
fi

The baffling thing here is, we get an error message like this and the installation gets aborted.

Space available in /opt is 450000KB. 100000KB required.

So, obviously /opt has enough space. Then why this gets into the if loop unnecessarily. What could be the problem? Any ideas??

This works fine on our test machines and the issue is happening at one of the customer's machines.

Thanks in advance,
JStone.