cancel
Showing results for 
Search instead for 
Did you mean: 

sapcontrol OSExecute not running as expected

Former Member
0 Kudos

I hope this is the right place to post this.

I've been trying to use the sapcontrol (webservices protocol GSOAP_HTTP) interface to perform an OSExecute webmethod, but am getting some strange responses.

I'm sending the required authentication with the command and receive a repsonse saying the the command has run (response code 0) and the PID of the run command. However the output of the command is never returned or written to a protocol file if specified in the command line.

I've also checked by running commands such as "touch /tmp/me" and the command never seems to actually run on the remote system. Very strange!

All other webmethods appear to work as expected (GetEnvironment etc...)

Version: 700, patch 95, changelist 886306, optu, linuxintel

Update:

ctbadm@ivml2005:/usr/sap/> sapcontrol -nr 00 -host 127.0.0.1 -user ctbadm sap123 -prot GSOAP_HTTP -function OSExecute ls 60 0

05.01.2011 15:43:59

OSExecute

OK

exitcode, pid, lines

0, 26005

Edited by: ChrisRiley on Jan 5, 2011 3:46 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

alwina_enns
Employee
Employee
0 Kudos

Hello Chris,

please use the full path to the OS command which you start with "OSExecute", so not only "touch" or "ls" but full path to these commands. Will it work? For me the command "sapcontrol -nr 02 -function OSExecute ls 0 30" does not work, but if I execute "sapcontrol -nr 02 -function OSExecute "/bin/ls" 0 30" it works.

Regards,
Alwina

Former Member
0 Kudos

Hi Chris,

You had any luck with OSExecute?

We are seeing the similar issue with OSExecute.

Thanks,

j_bayrhammer
Participant
0 Kudos

Hello Mahesh,

you do have to execute the command as follows:


sidadm> sapcontrol -prot NI_HTTP -host hostname.domain -nr <instance> -user sidadm password -function OSExecute "/bin/pwd" 0 30

Functions like "GetVersionInfo" work without "-user ...". For executing an os-command this is needed, otherwise you get an error like:


date time

OSExecute

FAIL: HTTP error, HTTP/1.1 401 Unauthorized

You can check access to functions with:


sidadm> sapcontrol -prot NI_HTTP -host hostname.domain -nr <instance> -function AccessCheck function

My problem is:

how do I create a protocol for osexecute command?

I get an error when using this command:


sidadm> sapcontrol -prot NI_HTTP -host hostname.domain -nr <instance> -user sidadm password -function OSExecute "/bin/pwd" 0 30 protocol="/home/sidadm/test"

date time

OSExecute

FAIL: Cannot create protocol file

Even if I want to create the protocol in /home/sapadm (user which executes the sapcontrol commands), this does not work.

Any idea?

Regards,

Julia

gabriella_kiss
Participant
0 Kudos

Hi,

please try to restart sapstartsrv and check afterwards the behaviour.

Please let us know the setting of paramter 'service/protectedwebmethods'.

What is the kernel version and release of sapstartsrv? Which OS?

Thanks Gabriella

alwina_enns
Employee
Employee
0 Kudos

Hello Julia,

I can create a protocol file as follow:

sapcontrol -nr 00 -function OSExecute "/bin/pwd" 0 30 /home/sidadm/test3

without "protocol=" for the protocol file name. What are the permissions for the directory /home/sidadm?

Regards,
Alwina

j_bayrhammer
Participant
0 Kudos

Hello Alwina,

thanks, this works on local and remote host. On remote host file is stored in remote folder.

Which user is doing these actions? sidadm or sapadm?

Regards,

Julia

alwina_enns
Employee
Employee
0 Kudos

Hello Julia,

I think the user under which sapstartsrv is running will do these actions.

Regards,
Alwina

j_bayrhammer
Participant
0 Kudos

Hello Alwina,

thank you, /usr/sap/hostctrl/exe/sapstartsrv runs with sapadm.

Regards,

Julia