cancel
Showing results for 
Search instead for 
Did you mean: 

Call Operating System Command Remotely.

Former Member
0 Kudos

Hello Friends,

I want to trigger the below mentioned unix command

"sapevt XI_DP_INTEGRATION -t name=SCD nr=00"

on remote server using Operating System command of File adapter.

Is this possible?

Also would appreciate some briefing on this.

Thanx

Anu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Anu,

Refer this weblog on executing OS commands...

/people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi

hope this helps...

Regards

Anand

Former Member
0 Kudos

Hello ,

As per the weblog

" The OS Command for the file adapter only runs on the system in which the Adapter Framework is running.

"

I want to execute command on remote server to which i connect using FTP. This system does not have AF.

Is it that only shell scripts can be executed from operating System command?

Can I execute command directly without putting it in a script?

Thanx

Anu

Answers (2)

Answers (2)

Former Member
0 Kudos

Anu,

I am trying the exact same thing as you were. We are on XI SP 15, did you figure out how you can call the operating system command remotely?

let me know, any help would be greatly appreciated.

Thanks

-Hashim

Former Member
0 Kudos

This is a rsh scenario. I doubt that anything else will work.

Regards

m

Former Member
0 Kudos

Hi, Anu.

i think your scenario would be fine.

In our project on Windows 2003, we used the OS commands like

the following scenario.

1. File Adapter OS Command calls batch script

2. batch script calls Perl script

3. perl script calls rsh command for executing commands remotely

(we used rsh asynchnously because we want our file adapter

finish their processes normally as soon as possible)

4. rsh returns return code

command executed via rsh runs on other host...

5. Perl script retuns return code

6. batch script retunrs return code to File Adapter

Basically, by using OS command, we can do anything which

is supported by OS. But you have to be careful about the

followings.

- Simultaneous execution of the same OS command(blocking and lock)

If you want to use simply redirect for logging your scripts,

you have to be careful because if the same scripts from

the OS command are run simultaneously, it would cause the

command behave strangely or hanged.

With perl, we used Log4Perl for logging purpose because this

solves lock problem also.

- Synchronous or Asynchronous

File Adapter will wait until the command returns the return

code. So, if your program might take long time, it would be

better to run asynchrously in your script.

- Simplicity for maintenance

If the scripts called from OS command do many things in many

places, it is very difficult to trace the behavior when error

happened.

Good Luck.

0 Kudos

Hi Anu,

Is there anyway the Adapter can dectect a bad (non zero)

return code from the script and have it register as a problem in the message?

Thanks,

Mich

Former Member
0 Kudos

Mich

Its an interesting question but I would say answer from SAP would probably be NO..Because to provide for a container to trap the return would be a difficult task I think..Instead probably a TRACE for the error is plausible..

My suggestion would be that you can redirect the error codes for calls from Commandline to a error file..Something like

Call <script> 2>> Error.txt which would trap errors for logging purpose..

If you have any interesting workarounds do let us know..

Regards

Sriram V.

Former Member
0 Kudos

Hello Mich,

the return code is not evaluated by the File Adapter.

Regards,

Thilo

former_member206604
Active Contributor
0 Kudos

Hi Anu,

Please make me clear, you are using FTP or File System(NFS). Incase of FTP you cannot execute any OS commands and executing an OS Commands using FTP makes no sense.

If you are using File System (NFS) then the OS commands can be execute provided you are giving the <b>fully qualified path and this is more important Eg:
systemname\Folder\Test.bat</b>

Try this and let me know.. I think this would work for you.