Operating System - HP-UX
1823920 Members
3089 Online
109667 Solutions
New Discussion юеВ

awk: Input line cannot be longer than 3,000 bytes.

 
Geoff Wild
Honored Contributor

awk: Input line cannot be longer than 3,000 bytes.

We added another volume group (10 total)and 2 more filesystems (148 total) to our cluster control file.

Now we get this error when the script trys to unmount the filesystems:

awk: Input line /dev/vg30/lvxfer /de cannot be longer than 3,000 bytes.
The source line number is 1.

Here's the function that does the unmount:

# Unmount each logical volume.

function umount_fs
{
for I in $(print ${LV[@]} | awk '{ for(i=NF; i>0; i--) print $i }')
do
mount | grep -E $I" " > /dev/null 2>&1
if (( $? == 0 ))
then
print "$(date '+%b %e %X') - Node \"$(hostname)\": Unmounting filesystem on $I"
print "\tWARNING: Running fuser to remove anyone using the filesystem directly."
fuser -ku $I
umount_count=0
until umount $I
do
print "\tWarning: Failed to umount $I"
fuser $I
(( umount_count = $umount_count + 1 ))
print "\tWarning: the $umount_count try to unmount $I"
if [[ $umount_count -ge 30 ]]
then
print "\tWarning: Umount failed $umount_count times . Will try to umoun
t $I one more time before giving up."
umount $I
break
fi
sleep 2
done
test_return 13
fi
done
}




Any ideas? The script works with 146 but not 148....

Rgds...Geoff




Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
9 REPLIES 9
Ian Dennison_1
Honored Contributor

Re: awk: Input line cannot be longer than 3,000 bytes.

Why not build the list of Logical Volumes to be processed into a file, each Logical Volume occupying a line? It sounds like there are no carriage returns in the output from the print command in the 'for' statement. Can you correct this?

If the order in which they appear must be reversed, then 'sed' the single link input putting carriage returns in, 'awk' the output with a sequential number (Zero filled, displayed using printf("%-4i", Integer)), sort in descending order and then read line by line using 'read' command and stdin redirection.

Share and Enjoy. Ian
Building a dumber user
harry d brown jr
Honored Contributor

Re: awk: Input line cannot be longer than 3,000 bytes.

Rewrite your script in perl or break up the input going into awk to be less than 3k.

live free or die
harry
Live Free or Die
Geoff Wild
Honored Contributor

Re: awk: Input line cannot be longer than 3,000 bytes.

Ian,

Interesting, but doesn't explain why it works with 146 logical volumes and dies at 148....

I thought of breaking it up into 2 arrays - "lv[0] - lv[99]" and "lv[100] - lv[199]".

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: awk: Input line cannot be longer than 3,000 bytes.

Harry,

So awk does have a 3000 byte input limit....

Thanks...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
James R. Ferguson
Acclaimed Contributor

Re: awk: Input line cannot be longer than 3,000 bytes.

Hi Geoff:

You might consider replicating the 'LV' array within the function, dropping the '/dev/' substring. Then, as necessary, add back the substring as you process in the loop.

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: awk: Input line cannot be longer than 3,000 bytes.

Yes, the record length limit varies between versions but 3000 would be typical. I have seen some that stop at 1024. One answer would be to download gawk from any of the HP-UX Porting Centre. Gawk has a dynamically allocated buffewr and can be set to any desired size by a command line argument.
If it ain't broke, I can fix that.
Geoff Wild
Honored Contributor

Re: awk: Input line cannot be longer than 3,000 bytes.

Just to let you know, I've placed a call with HP.

I wiil update you with the solution/assign points once this is resolved.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Wodisch
Honored Contributor

Re: awk: Input line cannot be longer than 3,000 bytes.

Hello Geoff,

get a copy of GNU awk and put its directory as the first into tha $PATH of your scripts.
GNU awk does not have that limit, IIRC...

HTH,
Wodisch
Geoff Wild
Honored Contributor

Re: awk: Input line cannot be longer than 3,000 bytes.

Here's the answer - We are at version 11.09 of MC Service Gaurad - the control file we were using is from 11.01 - the previos group that looked after this environment neglected to recreate the control file:

cmmakepkg -s

Here's what the 11.09 function looks like:

# Unmount each logical volume.

function umount_fs
{
integer UM_CNT=${FS_UMOUNT_COUNT:-1}
integer ret

set -A LogicalVolumes ${LV[@]}

if [[ $UM_CNT < 1 ]]
then
UM_CNT=1
fi

integer L=${#LogicalVolumes[*]}
while (( L > 0 ))
do
(( L = L - 1 ))
I=${LogicalVolumes[$L]}
mount | grep -e $I" " > /dev/null 2>&1
if (( $? == 0 ))
then
print "$(date '+%b %e %X') - Node \"$(hostname)\": Unmounting filesystem on $I"
umount $I; ret=$?
if (( ret != 0 ))
then
print "\tWARNING: Running fuser to remove anyone using the file system directl
y."
fi

UM_COUNT=$UM_CNT
while (( ret != 0 && UM_COUNT > 0 ))
do
fuser -ku $I
umount $I; ret=$?
if (( ret != 0 ))
then
if (( $UM_COUNT == 1 ))
then
let 0
test_return 13
fi
(( UM_COUNT = $UM_COUNT - 1 ))
sleep 1
if (( $UM_COUNT > 0 ))
then
print "\t$(date '+%b %e %X') - Unmount failed, trying again."
fi
fi
done
fi
done
}
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.