Script issue (353 Views)
Reply
Advisor
Bobby_HP
Posts: 16
Registered: ‎07-04-2012
Message 1 of 6 (353 Views)

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
 
 
 

 

 

Trusted Contributor
DBR
Posts: 214
Registered: ‎07-29-2010
Message 2 of 6 (342 Views)

Re: Script issue

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

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

 

Don

Advisor
Bobby_HP
Posts: 16
Registered: ‎07-04-2012
Message 3 of 6 (318 Views)

Re: Script issue

[ Edited ]

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

HP Expert
MattEash
Posts: 32
Registered: ‎01-22-2013
Message 4 of 6 (308 Views)

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 Product Manager
Valued Contributor
LarsB
Posts: 28
Registered: ‎03-23-2010
Message 5 of 6 (307 Views)

Re: Script issue

[ Edited ]

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
http://www.augustschell.com
Advisor
Bobby_HP
Posts: 16
Registered: ‎07-04-2012
Message 6 of 6 (298 Views)

Re: Script issue

[ Edited ]

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

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.