cancel
Showing results for 
Search instead for 
Did you mean: 

Unix script not working when executed from SAP PI communication channel

Former Member
0 Kudos

Hi Experts,

I am currently using the Run OS command after message processing functionality of the file adapter.

However, the unix script doesn't seem to work when run via communication channel.

The script runs properly when executed manually.

The communication channel logs don't show any error as well.

Do you have any ideas as to where the error might be.

Thanks,

Mike

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi All,

Thank you for your replies. I appreciate this.

@Anand, here is the script:

#!/usr/bin/sh
#version 1
hostname=$(uname -a | cut -f 2 -d " ")
MAILTO="michael.anthony.s.uy@gmail.com "
homedir=$PWD

echo $homedir | mailx -m -s "OB10 $hostname" $MAILTO
/opt/java6/bin/jar -xvf OB10.zip

ll | mailx -m -s "OB10 $hostname" $MAILTO

What's puzzling me is that I am able to receive the email alerts.

This means that the user has sufficient authorization to execute the script.

But the unzip command is not working.

I have seen the unzip work when run manually.

Thanks,

Mike

former_member189420
Active Participant
0 Kudos

Hi Mike,

The $homedir when executed manually will be your user's homedir while executed in SAP PI will point to SAP PI Service User's homedir. Try placing the file in an absolute path and give absolute path to the file and see.

Cheers,

Anand

naveen_chichili
Active Contributor
0 Kudos

Hi Mike,

You can check the script log in your log entry in the folder where you have deployed the script.That will give you a hint where exactly the problem is.

Regards,

Naveen

Former Member
0 Kudos

Hi Anand,

Do you know where the SAP PI service User home directory is located?

Is it in PI AL11?

Currently the script is in ECC AL11.

I want to check first if the unzipping works fine before we modify the script to place an absolute path.

Thanks,

Mike

Former Member
0 Kudos

Hi Naveen,

Do you know where the script log might be located?

I don't think the script is generating any log files at the moment.

Thanks,

Mike

former_member189420
Active Participant
0 Kudos

Hi Mike,

Sorry for the delay in responding. The SAP PI Service User will be on par with any user(your user) on the UNIX box. Add code to switch "user" in the script to your user. So that the subsequent commands will be executed with your user and it should be as if you are executing it manually.

Let me know how you go.

Cheers,

Anand

former_member189420
Active Participant
0 Kudos

Hi Michael,

Check whether the SAP PI Service user has authorization to execute the script. Try to use simple script or touch file commands to ensure the service user has authorization to execute commands at OS level.

Hope it helps!

Cheers,
Anand

Former Member
0 Kudos

Hi Michael,

Thats the disadvantage of scripts. We cant see logs in CC monitoring or anywhere. Do one thing, try to write logs into a log file in app server using "echo" at different stages of the code. You might get some idea on what's happening really.

gagandeep_batra
Active Contributor
0 Kudos

Hi

Check the following blog that may help to find the error;

& also check the authorization also

Regards

GB