Unix/Linux Go Back    


Open Source Open source oftware (OSS) is computer software with source code available with a license. The OSS copyright holder provides anyone the rights to read, modify, and distribute the software for any purpose.

Shell script file movement to a Mail Box server using ftp commands

Open Source


Tags
ftp from unix to mailbox

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-03-2015   -   Original Discussion by developer.dwh9
developer.dwh9's Unix or Linux Image
developer.dwh9 developer.dwh9 is offline
Registered User
 
Join Date: Dec 2011
Last Activity: 28 September 2016, 7:59 PM EDT
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Shell script file movement to a Mail Box server using ftp commands

Hi All,

I have a current Process that runs "windows script " for the file movement that needs to changed to a "DataStage Process (Using shell script )"

Source :Text file is getting generated as part of Datastage Jobs processes and resides in a shared drive (Unix server)

Target :ftp hostname "xxx.yyy.com " folder "ABC" is a mailbox location

Current Process :

Currently It is using following windows script to move the file



Code:
open xxx.yyy.com 
user name 
password 
prompt 
put "\\psoft8\output\FILE.TXT"%ABC%FILE 
quit

Can you please help me with FTP command OR syntax used for this file movement.

Thank you
Sponsored Links
    #2  
Old Unix and Linux 03-03-2015   -   Original Discussion by developer.dwh9
jim mcnamara's Unix or Linux Image
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 23 June 2018, 8:26 AM EDT
Location: NM
Posts: 11,417
Thanks: 629
Thanked 1,170 Times in 1,077 Posts
\\psoft8 looks like a samba (SMB) windows file share. In order to open that file on UNIX you have to install samba. So, something is missing. You can ftp from windows to UNIX, no problem.

So instead of showing us a code fragment that is of very little help:

1. Is this from windows to UNIX?
<your answer here>
2. Can it (the ftp part at least) run on Windows or does the script have to live on UNIX?
<another answer please>
3. Can the UNIX box see \\psoft (or whatever its name is on UNIX, maybe /psoft8) now? <yes or no>
Sponsored Links
    #3  
Old Unix and Linux 03-05-2015   -   Original Discussion by developer.dwh9
developer.dwh9's Unix or Linux Image
developer.dwh9 developer.dwh9 is offline
Registered User
 
Join Date: Dec 2011
Last Activity: 28 September 2016, 7:59 PM EDT
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
@Jim ..Thanks for the reply sorry for the confusion.

[\\psoft8]this is the windows server and Is OBSELTE NOW .. the proposed process is to place the file from unix server to Mail box location ftp server .

Responses :
1. Is this from windows to UNIX?
No ..this is from unix server to mail box location (ftp host)
2. Can it (the ftp part at least) run on Windows or does the script have to live on UNIX?
Script has to be reside on UNIX server ..Script has to be executed from DataStage Execute command Activity stage ..This stage takes the "FTP.sh " and Properties for the script.
3. Can the UNIX box see \\psoft (or whatever its name is on UNIX, maybe /psoft8 ) now? <yes or no>
No ..\\psoft is OBSELTE now

This is basic script I wrote to get the file from that mail box server



Code:
#!/usr/bin/bash 
#------------------------------------------------------------------------------------ 
# Name        : FTP.sh                                 
#---------------------------------------------------------------------------------------------------------------------------# 
HOST= 'xxx.yyy.com' 
user ='aaaa' 
password='bbbb' 

ftp xxx.yyy.com 
user $user $password 
get 00123456789 
quit 
END_SCRIPT 
Exit 0

Findings from Windows command prompt :



Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\X>ftp xxx.yyy.com
Connected to xxx.yyy.com.
220 Enterprise FTP server (Version 1.0.0 Nov. 5, 1996)
User (edi.cat.com:(none)): aaaa
331 Password required for aaaa
Password:
230-User logged in, proceed.
        Current Default Relationship - Recv: aaaa uuuu: *BINARY
        Get option: multiple
230
ftp> dir
200 Port command successful.
150 Opening ASCII mode data connection for transfer
Mailbox ID          St  APRZ           SYRF           Service Refs. #
abc                    N   SMAR          file123             00123
abc                    N   SMAR          file456             00456
226 Transfer Complete.
ftp: 2319 bytes received in 0.04Seconds 52.70Kbytes/sec.
ftp> get SMAR
200 Port command successful.
150 Opening ASCII mode data connection for transfer
226- 30 documents are received
226 Transfer complete.
ftp: 28687325 bytes received in 35.06Seconds 818.17Kbytes/sec.
ftp> lcd
Local directory now C:\Users\X.
ftp> get file321
200 Port command successful.
226- 0 documents are received
226 Transfer complete.
ftp> get 00123
200 Port command successful.
150 Opening ASCII mode data connection for transfer
226 Transfer complete.
ftp: 962245 bytes received in 0.31Seconds 3144.59Kbytes/sec.
ftp>

Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ftp file starting with particular name on Windows box to Unix box using shell script vijayb4u83 Shell Programming and Scripting 2 05-18-2009 11:37 PM
Shell script for FTP a file from one server to another server mahantysk Shell Programming and Scripting 0 09-17-2008 06:22 AM
FTP Unix Box to Windows Shell Script Jose Miguel Shell Programming and Scripting 2 07-11-2007 02:30 PM
concurrency issue while Accessing Mail Box from shell script Sumit_Fundoo UNIX for Advanced & Expert Users 2 02-25-2007 01:23 PM
how to move a file from one server to another server using FTP in shell script? forevercalz Shell Programming and Scripting 4 10-27-2005 01:53 AM



All times are GMT -4. The time now is 11:38 AM.