cancel
Showing results for 
Search instead for 
Did you mean: 

OS Command

Former Member
0 Kudos

Hi,

I am trying to execute OS command on unix(XI box itself) through receiver file adapter. Receiver file adapter is creating the ouput file but OS command is not getting executed. I have a very simple shell script without any parameters. The shell script just re-names the file and is working fine on unix command prompt. Any idea as to what could be the problem or any way I can monitor the OS command execution.

Thanks

Anand

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi, Anand.

i also got the similar problem with the OS command a few months ago.

What i've found was like the following.

1. In XI 3.0 SR1 without any patches or SPs, this function dosen't work.

2. With SP10 or above, this works and its behavior is exactly same as Runtime.exec(String command) method of Java.

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#exec(java.lang.String)

So, i recommend you to code some simple Java program with the Runtime.exec(String command) and try your script as the parameter of this method.

Thanks.

Former Member
0 Kudos

Anand,

Did you ever get this figured out? I am wanting to send a file to a unix system and then run a script I wrote (that will process the file). It seems like you cannot run unix shell scripts through the FTP connection.

Former Member
0 Kudos

To run a command on the FTP Server you will need an FTP Server which actually supports the "SITE" command and then you need to get the file adapter to send this "QUOTE SITE" command. (no idea if this is possible)

I guess it is better to use a scriptable ftp server where you can trigger on the PUT.

If you ask me: dont use FTP to trigger jobs (or not at all).

Greetings

Bernd

Former Member
0 Kudos

Hello Bernd,

while <i>QUOTE SITE</i> would generally be the way to go, the File Adapter currently does not support sending this command to the FTP server.

Regards,

Thilo

Former Member
0 Kudos

Keith,

In our case We are writing file local XI box and then we do a FTP using the shell script. As such we could'nt figure out where to see logs for shell script execution. Instead with in a shell script we captured the log for each command we execute .

Regards

Anand

former_member185751
Contributor
0 Kudos

Hi,

See if this thread helps:

Regards,

Sridhar

Former Member
0 Kudos

Hi Srdhar,

I went though the thread and everythings looks o.k. But the command does not work. Anyway we can monitor the execution of the command.

Thanks

Anand

former_member185751
Contributor
0 Kudos

Hi,

Check the trace/logs for file adapter service in the WebAS using Visual admin.

Regards,

Sridhar

former_member185751
Contributor
0 Kudos

Hi,

Refer to this OSS note: 820082

It may help you.

Regards,

Sridhar

Former Member
0 Kudos

Hi Sridhar,

Thanks for the reply. we are on SP11.

In the OS command field for the receiver file adapter I gave my command with the full path name followed by

%f(%F). i.e /home/test/command.sh %f also tried with /home/test/command.sh %F. is there anything wrong with the syntax ?

My OS command resides on XI server itself and accesses XI directories.

Thanks

Anand

former_member185751
Contributor
0 Kudos

Hi,

Pls note:

<i>%f (file name)

%F(absolute file name including path)</i>

Make sure you have given the correct FULL directory path for the shell script command that you are using.

Can you tell me what you are trying to achieve with this OS command? What is your requirement ?

Regards,

Sridhar

Former Member
0 Kudos

Hi Sridhar,

For testing purpose I just wrote script which will just rename the file without accepting any parameters. In the OS command I specified OS command with full path without any %f or %F. Later I tried with other options

i.e with %f and %F. but none of them seem to be working.

Thanks

Anand

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

on some unix systems there's a "history file"

http://www.unix.org.ua/orelly/networking/puis/ch10_04.htm

maybe you can use this to see if the file adapter OS command is being executed at all?

ask someone from your basis team they should give you more details

Regards,

michal

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

but please before setting this on your unix system

contact ask your basis people because folder logging can make your system very slow...

Regards,

michal

former_member185751
Contributor
0 Kudos

Hi,

I have ran out of all answers for this question

If you want to rename a file, File adpater has been enhanced with a new feature of providing dynamic file names in SP12. Check it out at http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

Regards,

Sridhar

Former Member
0 Kudos

Have you tested your script with the same unix user that XI is executing the command?

For security reasons running shell scripts for unix users that do not need this feature is not allowed. Running self made scripts should be blocked because this way you could affect whole system. So as Michal wrote in his post you should consult your basis guys what are the permissions for user executing the script.

For any further investigation please provide file details - that is output of ‘ls –la’ command for scripts and for files created with XI.

Regards and pozdrawiam

-- Grzegorz Malewski

Former Member
0 Kudos

Hi Grzegorz,

we have tried executing the shell script from message mapping and found to be working fine but does'nt work from receiver file adapter.The script and the directory it accesses all reside on XI server itself. Anyway I'll check with Basis on this.

Thanks

Anand

Former Member
0 Kudos

Since running shell scripts might be sometimes tricky can you check if it runs plain unix commands?

-- Grzegorz