Server Automation Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Script issue

Highlighted
Bobby_HP
Occasional Contributor

Script issue

Hi,

 

Can anyone explain why the error is existing for the below script

 

#!/bin/sh
echo $1
cd /opsw/Server/@/$1/method
setCustomField fieldName="patch_code" strValue="211"
*************************************************
Output:
 
./patchcodeloop <Server Name>
 ./patchcode: line 4: setCustomField: command not found
 
 
 

 

 

5 REPLIES
DBR
Frequent Visitor

Re: Script issue

You need to add ./ in front of the command.

./setCustomField fieldName="patch_code" strValue="211"

 

Don

Bobby_HP
Occasional Contributor

Re: Script issue

Thanks Don..!!

 

But no luck after adding with ./ and also is there any compatibilty with OS - 2003/2008..??

 

we are getting the error for wind - 2003x86

 

Any suggestions..??

 

Regards,

Bobby

MattEash
HPE Expert

Re: Script issue

My guess is that your <ServerName> is not properly matching the "ServerName" in SA.

Have you tried running your shell with debug or with the "-x" option.

This may return a bit more detail for you to use / share for debugging.

The global shell is running in the Unix environment. If there are spaces in your server names you'll need to account for them in your scripting as well.

Hopefully this helps a little, share the output if you can so that we can see it.

- - - - - - - - - - - - - - - - -
Matt Eash
Server Automation Practitioner
LarsB
Member

Re: Script issue

It worked for me after the suggested change:

#!/bin/sh
echo $1
cd /opsw/Server/@/$1/method
./setCustomField fieldName="Bldg Zip Code" strValue="00000-0000"

 

I like to use OGFS by OpswareIDs so I dont have to code around spaces or other special characters users put in the opsware name:

 

cd /opsw/.Server.ID/$1/method/

 

 

-- Lars
Bobby_HP
Occasional Contributor

Re: Script issue

Hi Eash,

 

The Server names matches in HP SA

 

I tried ./patchcodeloop -x and received no output.  Still same results

 

Any suggestions and let me know any other commands to execute.

 

Do we have any compatibility here for windows nodes..??

 

Regards,

Bobby

//Add this to "OnDomLoad" event