imthekrish Respected Contributor.
Respected Contributor.
1642 views

Run script as a root user HPSA- HPOO

Jump to solution

Hello All,

I want to run script which is on the server and this server is managed in HPSA. I should run script as a 'xyz' user. 

I tried from SA java client, i selected runscript, root, run adhoc and at import i did su -c /path/to/file.sh xyz. The script is executed by xyz user on managed server, which is what im looking for. When i select root, it doesnt ask me for password. in SA client.

Now, i tried the same from HPOO. I choose start adhoc server script operation, and i cannot run as root from this operation. It is asking for username and password. Like i mentioned above user is root and password empty since i dont have root password.

Is there anyother operation/ way for doing this ?

Labels (1)
0 Likes
1 Solution

Accepted Solutions
imthekrish Respected Contributor.
Respected Contributor.

Re: Run script as a root user HPSA- HPOO

Jump to solution

Thank you so much!! I learnt about wait for job and get script job result after you told me, I appriciate your help.

To run script as a root user, u can send username and password empty.

0 Likes
8 Replies
Bridges Respected Contributor.
Respected Contributor.

Re: Run script as a root user HPSA- HPOO

Jump to solution

The username and password expected is the same as you used to login to the SA java client.

You could also use OGFS to execute the script via the SSH operation.

 

0 Likes
imthekrish Respected Contributor.
Respected Contributor.

Re: Run script as a root user HPSA- HPOO

Jump to solution

you are saying that username and password should same as coreUsername and corePassword. I tried that and i see response completed with errors.

And when you said OGFS, do u mean Start OGFS operation. This operation doesnt have option to give targetServer Name. If u talking about anothe operation, could you please give me the path of the operation.

0 Likes
Bridges Respected Contributor.
Respected Contributor.

Re: Run script as a root user HPSA- HPOO

Jump to solution

I'm not sure what completed with error referrs, except that you have an issue.  Did you provide all the required fields?  Does your account have access in SA to run scripts?  Is the script imported into SA?

OGFS is part of SA.  You can get to it via SSH and port 2222 (default). 

0 Likes
imthekrish Respected Contributor.
Respected Contributor.

Re: Run script as a root user HPSA- HPOO

Jump to solution

Yes I gave all the required inpiuts... Yes the id have all permission to run script ..... like i said i tried it from SA client and it works from client. I cannot do it from HPOO -> HPSA ->server. The script is not imported to SA. The script is on server.

coreHost: xxx.xxx.com

coreport: 443

coreProtocol: https

coreUsername: username with which i logged into client

corePassword: password with which I logged into client

coreVersion: sas102

sourceCode: su -c /path/to/file.sh xyz

sourceCodeType: SH

scriptArguments:

serverName: xyz.xyz.com

serverId: 

loginDomain:

username: username with which i logged into client

password: password with which i logged into client

scriptTimeout: 100000

separator: ,

ticketId: 

notificationFailureOwner - 
notificationSuccessOwner -
notificationCancelOwner - 
notificationFailureRecipients - 
notificationSuccessRecipients - 
notificationCancelRecipients - 
scheduleDateYear - 
scheduleDateMonth - 
scheduleDateDayOfMonth - 
scheduleDateHour - 
scheduleDateMinute -
scheduleDateSecond - 
scheduleDateTimezone -

Response:

{returnCode=0;jobId=1234567890;returnResult=The job having the id 1234567890 is not yet completed.;Result=0;}

 

 

 

0 Likes
imthekrish Respected Contributor.
Respected Contributor.

Re: Run script as a root user HPSA- HPOO

Jump to solution

i tried with 

corePort - 2222
coreProtocol - SSH

It didnt work..... i dont have permissions to do SSH and i will not be given permissions to do that.

So, is there a way to do this on 443 port

0 Likes
Bridges Respected Contributor.
Respected Contributor.

Re: Run script as a root user HPSA- HPOO

Jump to solution

From your output it looks like the script is executing.  You will need to use the Wait for Job operation and the get the results via the Get Script Job Results operation.

0 Likes
imthekrish Respected Contributor.
Respected Contributor.

Re: Run script as a root user HPSA- HPOO

Jump to solution

Thank you so much!! I learnt about wait for job and get script job result after you told me, I appriciate your help.

To run script as a root user, u can send username and password empty.

0 Likes
Wodisch Acclaimed Contributor.
Acclaimed Contributor.

Re: Run script as a root user HPSA- HPOO

Jump to solution

Hi,
Have a look to the flow I posted at the HPLN:
https://hpln.hpe.com/contentoffering/demo-flow-sa-startserverscriptandqueryjob-how-run-server-script-all-servers-device-group
It does just what you ask for: run an SA-ServerScript from OO-Central, wait for it to end, and retrieve the exitcode/output.

FWIW,
Wodisch

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.