![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| #!/bin/sh script fails at StringA | tr "[x]" "[y]" | by_tg | UNIX for Dummies Questions & Answers | 3 | 02-22-2008 09:17 AM |
| Put fails during FTP | prakash.kudreka | UNIX for Advanced & Expert Users | 2 | 11-15-2007 02:14 AM |
| SCP fails sometimes | vipinc | AIX | 10 | 07-17-2007 11:38 PM |
| Shell Script fails with "can't connect to client" | sseenu79 | HP-UX | 2 | 12-20-2006 07:47 AM |
| System Fails | nikk | UNIX for Advanced & Expert Users | 2 | 07-07-2004 06:05 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Quote:
Try this. Code:
REQUIRED_SPACE=100000
AVAILABLE_SPACE=$(df -k /opt | grep -vi "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
|
|
#3
|
|||
|
|||
|
Hi, Thanks for the reply. That was a typo by mistake. I iterate that I have installed the package successfully in our test enviroment so many times, I am just trying to figure out the reason for the failure on the customer's machine. Could that be something related to their machine settings?? By the way, what is the shell used during an install?
|
|
#4
|
||||
|
||||
|
The shell used during an install will usually depend on the shebang that is present in the installation script.
Try the following Code:
set -x ./run your script set +x |
|
#5
|
|||
|
|||
|
Hi, Thanks for your suggestion. I will do that.
|
|
#6
|
||||
|
||||
|
With AIX, the df command output shows the free space in the field 3 and the field header is'nt 'avail' but 'Free'.
Code:
$ df -k /opt Filesystem 1024-blocks Free %Used Iused %Iused Mounted on /dev/hd4 163840 32724 81% 1847 3% / Code:
$ df -kP /opt Filesystem 1024-blocks Used Available Capacity Mounted on /dev/hd4 163840 131116 32724 81% / Last edited by aigles; 08-09-2006 at 01:20 AM. |
|
#7
|
|||
|
|||
|
if the disk space for a single mount is determined, no to check for the word whether it is avail or free ...
either way the disk space with a -k option for a single mount would be displayed only in the following format header values for the single mount now eliminate the first line that is process only the second line |
|||
| Google The UNIX and Linux Forums |