Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Need help with ftp from fex with -UNIX shell script

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Need help with ftp from fex with -UNIX shell script
 Login/Join
 
Gold member
posted
I'm trying to ftp a file from a UNIX box to a Windows box from within a FEX. Code seems simple but does not work. It seems I'm logged into the remote box based upon the 'Connected' message but it is still prompting for the user/pw. Note: the abcd1234 box contains a virtual IIS directory (report_ftp) that points to the final destination box where remotefile1.xht will reside.

Any ftp-ers out there? Thanks!

-SET &winmach='abcd1234';
-SET &user1='user001';
-SET &pw1='pw001';
-UNIX #!/bin/ksh
-UNIX ftp -n -d -v &winmach <-UNIX USER &user1 &pw1
-UNIX cd/report_ftp
-UNIX binary
-UNIX put hostfile1.xht remotefile1.xht
-UNIX END_SCRIPT
-UNIX bye


The following messages occur:

Connected to abcd1234.ab1.prod.
220 ABCD1234 Microsoft FTP Service (Version 5.0).
---> SYST
530 Please login with USER and PASS.
---> QUIT
221

Using WebFOCUS 7.1.1

This message has been edited. Last edited by: Kerry,


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Expert
posted Hide Post
Are you providing the userid and pw of the box you are ftping to? That would be required.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
The userid/pw I provide are to the box containing the virtual directory that then points to the destination box.


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Expert
posted Hide Post
quote:
<-UNIX USER &user1 &pw1


I don't know what that syntax is above. Can you just stack the windows userid and password on separate lines in your script as replies to prompts like you have with the other ftp commands. Not very secure but .....


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
Tried that as well with no success...


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Expert
posted Hide Post
I think I know why your code is not working. Every time you do a -UNIX or ! command, you shell out to the operating system. That worked great for the first command. Then you come back to the fex and issue another command to shell out again. But it is different.

It would probably be better if you put the ftp commands in a script file and just execute the script file from the focexec. That way you'd be going out to Unix just once, execute all the commands and then come back to the fex.

Also did you know that you can do ftp from Report Caster.

And lastly, please update your profile signature to indicate your product suite, releases, and platform so that we can better help you.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
Thank, I did figure that out as well. However, still no luck.

Is there special syntax/naming conventions for processing a script file?


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Expert
posted Hide Post
Here is a command that one of my users has in her focexec:

!/WebFOCUS/ibi/apps/sf_script/dl_sdays2.ksh

I don't know if that is what you are looking for.

Another thing I might suggest is that you go to a Unix prompt and try to run an ftp to your target box by typing the commands in by hand. If they don't work from there, they won't work from a script either and it might mean that something else is wrong.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Master
posted Hide Post
Do this all the time. Here's the code from one of a fex.
-UNIX /opt/ibi/apps/yi684/yi684ftp.sh

Here's the script
#!/bin/csh
cd /opt/ibi/apps/reports
smbclient //s92x01/workgroups "password" -Iipaddr -Wdomain -Uuserid<< :end
cd "Child Welfare/Reports/YI684"
put yi684l.csv
put yi684bl.csv
put yi684cl.csv
put yi684dl.csv
put yi684el.csv
put yi684pl.csv
put yi602l.csv
quit
:end

As you can see we use smbclient to ftp to Windows servers from our Linux host. Works great.

One other thing, make sure your script is flagged as an executable.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Platinum Member
posted Hide Post
Hi,

Our webfocus server runs on windows and this is an example what I use to ftp from data from a UNIX box to a network drive on windows. This FEX builds the ftp script as a temp file and then executes it:

FILEDEF FTPSCR DISK ftpt0003.txt
-RUN
-*
-WRITE FTPSCR open unix001
-WRITE FTPSCR user001
-WRITE FTPSCR psw001
-WRITE FTPSCR lcd "\\SOME\NETWORK\DRIVE\ON\WINDOWS"
-WRITE FTPSCR ascii
-WRITE FTPSCR cd /some/directory/on/unix001
-WRITE FTPSCR get unix001-file001
-WRITE FTPSCR bye
-CLOSE
-*
DOS ftp -i -s:ftpt0003.txt
-*

The ftp script can be copied and saved if needed.

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Gold member
posted Hide Post
Hi and thanks for helping! I just saw an older post of your re: ftp and was about to email you when I saw this response.

I am getting a 'cannot execute' message when trying to execute the script. I assume this is because it is not flagged as an executable?

Just how do I flag the 'sh' script file as an executable from WF Dev. Studio? One thing, it won't let me name the script with an 'sh' extension, so I have to go to a file manager to do that.

Haven't used smbclient before, so I'm looking forward to getting to the point of execution.


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Platinum Member
posted Hide Post
Hi,

Hopefully someone that has WF running on UNIX can help us out here.

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Expert
posted Hide Post
To change the permissions on the file in Unix, you have to log onto the box, go to the directory where the script is, and do a chmod to make the script executable.

You must own the file or be in the group that owns the file and have owner and group write permissions to do this.

Let's say that you have a file that when you do an ls -l on it, it comes back like this:

-rw-rw-r-- 1 userid sf 109 Nov 30 15:38 ftp_put_to_win.ksh

In this example the first group of triplets is the owner permissions, the second is the group, and the third is world or everyone. If you wanted to make it executable for you and everyone in your group, you could say:

chmod u+x,g+x ftp_put_to_win.ksh

Your result would be:

-rwxrwxr-- 1 userid sf 109 Nov 30 15:38 ftp_put_to_win.ksh

There are other ways to do chmod permissions like using octal numbers but I find this way more readable. You can get more detail by doing man chmod at your Unix prompt.

If you do not own the file, you will have to get an admin to change the permissions for you.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
I now have the permissions but no luck yet. It finds and executes the script and seems to have connected but still getting error messages.

Calling command from FEX:

-UNIX /path/ftpshell4.sh

Script (ftpshell4.sh):

#!/bin/ksh
pwd
ftp -ndv server001
user001
pw001
cd/report_ftp
binary
put carpdf1.pdf carpdf1t.pdf
bye

Log:

Connected to server001.
220 AD1HFDPST001 Microsoft FTP Service (Version 5.0).
---> SYST
530 Please login with USER and PASS.
---> QUIT
221
/path: user001: not found
/path: pw001: not found
/path: cd/report_ftp: not found
/path: binary: not found
/path: put: not found
/path: bye: not found

Also tried using USER and PASS commands in script with same result.


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Expert
posted Hide Post
As I mentioned before, please run your script from the Unix prompt to make sure that it works that way and take WF out of the equation. That way you will know you can get to the remote box from your Unix box.

Once that is working, try it again from WF. If it still doesn't work after all of that, then open a case with IBI.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
The commands do work from the UNIX prompt.

I will open a case.

Thanks for all your help.


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Expert
posted Hide Post
I don't know if this is a stupid suggestion and I don't know what the difference is, but have you tried

UNIX /path/ftpshell4.sh
-RUN

instead of

-UNIX /path/ftpshell4.sh

?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Francis,

Being a virtuoso, you know by now there are no stupid suggestions when it comes to FOCUS. I have tried what you suggested and in both UPPER and lower case. Result: no differences.

Thanks, though.


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Guru
posted Hide Post
We do this all the time:
-UNIX cd /opt/app/ibi71/ibi/apps/dcl
-UNIX dcl.ftp


Where dcl.ftp is the unix ftp script. You need execute permission for the user that runs on Unix like several others have explained. Do you know what user you are running as?

Here is the script:
 
SERVER=app000000       # Name of Windows Server
DIR=/opt/app/ibi71/ibi/apps/dcl  # Directory on Unix
DDIR=SomeWindowsDirectory  # Directory on $SERVER
FILE="*.pdf"     # File name pattern to transfer
USER=network\\\\\\\\wuser # User name on Windows network- must replace bslash with 8
PASS=password         # Password of $USER

if [ ! -f $DIR/$FILE ] ; then                  # Check if file exists
   echo $DIR/$FILE does not exist
   exit 1
fi

cd $DIR        # cd to directory containing file
  
(
echo "
      open $SERVER
      user $USER $PASS
      bin
      cd $DDIR
      put $FILE
      close
     "
) | ftp -i -n > dclftp.out

WORDS=`wc -l <dclftp.out`

if [ $WORDS -ne 0 ] ; then
   echo FTP errors
   exit 1
fi

 


It always works.


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Member
posted Hide Post
Could you guys please share with me the technique or procedure to do this the other way around? I mean from windows to unix box.

I need to write a PDF to a unix box using secure ftp.

thanks,
gajee


webfocus 7.6.4
Windows, HTML, PDF
 
Posts: 6 | Registered: September 02, 2010Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Need help with ftp from fex with -UNIX shell script

Copyright © 1996-2020 Information Builders