Operating System - Linux
1753626 Members
5287 Online
108797 Solutions
New Discussion юеВ

Re: Problems on execute script

 
SOLVED
Go to solution
Carles Viaplana
Valued Contributor

Problems on execute script

Hello,

I want to execute the following script but since system was rebooted I can't:

#!/sbin/sh -x
fs=vgora/lvol5
max=70
min=30
volum="$(bdf |grep $fs | tr -s ' ' '$' | cut -f5 -d $ | cut -c1-2)"
if [ "$volum" -ge "$max" ]
then
remsh omniback /opt/omni/bin/omnib -oracle8_list Oracle_Archivers_Paris_Total 2>> /DES/oracle/arch/scripts/sortida
>> /DES/oracle/arch/scripts/sortida
fi
if [ "$volum" -ge "$min" ] && [ "$volum" -lt "$max" ]
then
remsh omniback /opt/omni/bin/omnib -oracle8_list Oracle_Archivers_Paris 2>> /DES/oracle/arch/scripts/sortida
>> /DES/oracle/arch/scripts/sortida
fi

Output I got when I launch script is as follows:

+ fs=vgora/lvol5
+ max=70
+ min=30
+ + bdf
+ grep vgora/lvol5
+ tr -s $
+ cut -f5 -d $
+ cut -c1-2
volum=0%
+ [ 0% -ge 70 ]
/DES/oracle/arch/scripts/volum.sh[12]: 0%: Expression is not complete; more tokens expected.
+ [ 0% -ge 30 ]
/DES/oracle/arch/scripts/volum.sh[17]: 0%: Expression is not complete; more tokens expected.

Should I modify any kernel parameter?

Thanks in advance for your help!

Carles

PS: System is HP-UX B.11.11 U
7 REPLIES 7
RAC_1
Honored Contributor

Re: Problems on execute script

You if comparision statements are wrong because your volum assignment is wrong.

Why tr and all that??

volum=$(bdf / |grep -v '[F]ilesystem'|awk '{print $5}'|awk -F "%" '{print $1}')

Then your comparisions.

Check your assignment and the one I am giving here. You need to eliminate % from var assignment.
There is no substitute to HARDWORK
Piergiacomo Perini
Trusted Contributor

Re: Problems on execute script

Hi Carles,

maybe it's a stupid question but
are you sure that file system is mounted
(fs=vgora/lvol5) ?

regards
Carles Viaplana
Valued Contributor

Re: Problems on execute script

Thanks for your fast reply,

1st at all, volume and filesystem is mounted.

I'm going to delete % from assignement and execute script.

I know script didn't work fine as volum assignement is wrong, but why does script stop to run since reboot?

Regards,

Carles
Muthukumar_5
Honored Contributor

Re: Problems on execute script

Change this to volum="$(bdf |grep $fs | tr -s ' ' '$' | cut -f5 -d $ | cut -c1-2)"

volum=$(bdf | grep $fs | awk '{ split($5,a,"%");print a[1]; }')

hth.
Easy to suggest when don't know about the problem!
Carles Viaplana
Valued Contributor

Re: Problems on execute script

Hello again,

Script works fine now. Thanks a lot!

BTW, is there any way to avoid output messages?

Thanks again,

Carles
James R. Ferguson
Acclaimed Contributor
Solution

Re: Problems on execute script

Hi Carles:

The use of the '-x' switch causes trace messages to be printed to STDERR during the script's execution. This is normally only armed for debugging.

Remove the '-x' switch from the interpreter line (#!/sbin/sh) to eliminate the STDERR or redirect STDERR to /dev/null when you execute the script ( e.g. /myscript 2> /dev/null ).

Regards!

...JRF...
Carles Viaplana
Valued Contributor

Re: Problems on execute script

I modified script and now it works fine and doesn't show messages.

Thanks to all for your help.
Regards,

Carles