cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in script

Former Member
0 Kudos

Hi,

I have a simple file to file scenario for testing purpose. Here I am using a shell script in the before processing of sender communication channel .

My aim is when I will rum the sender communication channel as the script is in before processing it will pick a .zip file from ftp of path /TEST/ and extract it and put the text file in another folder of the same ftp called /TEST2/ .

My script is running fine when I am testing it in PUTTY , but the problem is when I am putting it in the PI server and calling from communication channel its not working at all.

Here is my script :

#!/bin/sh

HOST=10.16.21.85

USER="migra_user"

PASSWD="apdcl"

dirName=/Test

dirName2=/Test2

ftp -n -i -v $HOST <<EOF

user $USER $PASSWD

cd $dirName

mget *.zip

quit

EOF

for z in *.zip;do unzip $z;done

rm *.zip

ftp -n -i -v $HOST <<EOD

user $USER $PASSWD

cd $dirName2

mput *.txt

quit

EOD

rm *.txt

And I am calling it from communication channel like that -

Please suggest me how to get rid of this.

Thanks,

Accepted Solutions (0)

Answers (4)

Answers (4)

iaki_vila
Active Contributor
0 Kudos

Hi Apu,

Have you tried to put your host between apostrophes? like HOST="10.16.21.85"

Regards.

iaki_vila
Active Contributor
0 Kudos

Hi Apu,

As far as i know you cant do a logging via script. With NFS is not supported to execute the ftp command (im not 100% secure about this). To achieve your requeriment i think it's better to get the zip via ftp protocol and unzip the file in PI system using the PayloadZipBean module (http://help.sap.com/saphelp_nw73/helpdata/en/45/da9358a1772e97e10000000a155369/content.htm). Also you can do your own zip/unzip module like this Roger Allue's blog http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/04/29/module-payloadgzipbean-zip-and-un...

I re-edit because i was wrong, you can use the FTP command with the FTP protocol like this wiki shows http://wiki.scn.sap.com/wiki/display/XI/SAP+XI+File+Adapter+OS+Command+Line+Feature

The only problem could be with the apostrophes or quotes, check this note  841704  - XI File & JDBC Adapter: Operating system command

Regards.

Message was edited by: Iñaki Vila

javier_alcubilla
Contributor
0 Kudos

Hi Apu

The problem should be the user permissions. Take in account that you're executing the script with user SAPService<SID>

When you try through putty maybe you are using an administrator with all the authorizations

Regards

Javi

gagandeep_batra
Active Contributor
0 Kudos

Hi Apu,

for FTP your script will not work, script will work for only NFS protocol

& script will execute only PI server.

Regards

Gagan