Sponsored Content
Top Forums Programming Open Source Shell script file movement to a Mail Box server using ftp commands Post 302937370 by developer.dwh9 on Thursday 5th of March 2015 09:24:05 AM
Old 03-05-2015
@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>

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to move a file from one server to another server using FTP in shell script?

I have a file --> file1.txt i need to copy this file to another server using FTP....the 2 servers are server1 and server2..may i know how to write a script that can do this? thanks in advance! Im a newbie to this... (4 Replies)
Discussion started by: forevercalz
4 Replies

2. UNIX for Advanced & Expert Users

concurrency issue while Accessing Mail Box from shell script

Hi Bros, I am in a serious trouble with concurrency issue while using mailx. I have a shell script which reads all the emails of a unix user account and create a copy (another mbox for processing and archive purpose). This script works fine for 99.99% of the time but sometime it start creating... (2 Replies)
Discussion started by: Sumit_Fundoo
2 Replies

3. Shell Programming and Scripting

FTP Unix Box to Windows Shell Script

Hello All, Could someone help me out with this? I want to incorporate this into an existing script so the output of a SAS job can be ftp'd from our UNIX box to a directory on a drive in Windows environment. Can this be done with no extra third party software? We currently use Putty for copy... (2 Replies)
Discussion started by: Jose Miguel
2 Replies

4. Shell Programming and Scripting

Shell script for FTP a file from one server to another server

Hi Can any one help me for script. I need a script and this script has to execute daily to move the files. FTP from one server to another server EX: Sep 10 06:24 abc.txt Sep 11 06.56 abc.txt Sep 12 08.23 abc.txt these files are located at a/b/c/e/f in 123 server and copy... (0 Replies)
Discussion started by: mahantysk
0 Replies

5. Shell Programming and Scripting

How to use ftp commands inside shell script? Help please

Dears, I'm new in shell scripting and i need your help, i would like to know how can i create a script to ftp to a certain unix/linux machine/server IP address and get a file for example without user intervention? How can i force the script to use a certain username and password to access this... (4 Replies)
Discussion started by: Dendany83
4 Replies

6. Shell Programming and Scripting

ftp file starting with particular name on Windows box to Unix box using shell script

Hello all ! I'm trying to write a shell script (bash) to ftp a file starting with particular name like "Latest_" that is present on a Windows box to UNIX server. Basically I want to set this script in the cron so that daily the new build that is posted on the Windows box can be downloaded to the... (2 Replies)
Discussion started by: vijayb4u83
2 Replies

7. Shell Programming and Scripting

How to FTP the latest file, based on date, from a remote server through a shell script?

How to FTP the latest file, based on date, from a remote server through a shell script? I have four files to be FTP'ed from remote server. They are of the following format. build1_runtime_mmddyyyy.txt build2_runtime_mmddyyyy.txt build3_runtime_mmddyyyy.txt buifile_count_mmddyyyy.txt ... (9 Replies)
Discussion started by: imran_affu
9 Replies

8. Shell Programming and Scripting

Commands not executing after FTP in shell script

Hello In the shell script we have a FTP command like below ftp -n -v -q winftp.principal.com >/infa/datafiles/GRP/Scripts/ftp_from_infa_dvcn.log<<END_SCRIPT   quote USER $FTP_USER quote PASS $FTP_PASS ascii lcd $FTP_LOCALDIR cd $FTP_FLDR put $FTP_FILE   bye exit If i... (1 Reply)
Discussion started by: Pratik4891
1 Replies

9. Shell Programming and Scripting

Download latest file via ftp server unix through shell script

Hello this is my first post in this forum , I dont want to be unhappy.. I am writing one script but facing difficulty to find the latest file with some new pattern My requirement is 1. The file is coming like "ABCD-23220140303" at FTP server once in a week. 2. script will run on daily... (3 Replies)
Discussion started by: ajju
3 Replies

10. How to Post in the The UNIX and Linux Forums

Copying , renaming the file from windox box and ftp to Linux box

Hello my dear friends, Two file are auto generated from mon - fri at different directories on same windows box.Every day i have to copy the file, rename it (specific name)and ftp it to linux box specified directory. is it possible to automate this process,If yes this has to be done from windows... (1 Reply)
Discussion started by: umesh yadav
1 Replies
SMBTAR(1)																 SMBTAR(1)

NAME
smbtar - shell script for backing up SMB/CIFS shares directly to UNIX tape drives SYNOPSIS
smbtar -s server [ -p password ] [ -x services ] [ -X ] [ -d directory ] [ -u user ] [ -t tape ] [ -t tape ] [ -b blocksize ] [ -N filename ] [ -i ] [ -r ] [ -l loglevel ] [ -v ] filenames DESCRIPTION
This tool is part of the Samba suite. smbtar is a very small shell script on top of smbclient(1) which dumps SMB shares directly to tape. OPTIONS
-s server The SMB/CIFS server that the share resides upon. -x service The share name on the server to connect to. The default is "backup". -X Exclude mode. Exclude filenames... from tar create or restore. -d directory Change to initial directory before restoring / backing up files. -v Verbose mode. -p password The password to use to access a share. Default: none -u user The user id to connect as. Default: UNIX login name. -t tape Tape device. May be regular file or tape device. Default: $TAPE environmental variable; if not set, a file called tar.out . -b blocksize Blocking factor. Defaults to 20. See tar(1) for a fuller explanation. -N filename Backup only files newer than filename. Could be used (for example) on a log file to implement incremental backups. -i Incremental mode; tar files are only backed up if they have the archive bit set. The archive bit is reset after each file is read. -r Restore. Files are restored to the share from the tar file. -l log level Log (debug) level. Corresponds to the -d flag of smbclient(1) . ENVIRONMENT VARIABLES
The $TAPE variable specifies the default tape device to write to. May be overridden with the -t option. BUGS
The smbtar script has different options from ordinary tar and tar called from smbclient. CAVEATS
Sites that are more careful about security may not like the way the script handles PC passwords. Backup and restore work on entire shares, should work on file lists. smbtar works best with GNU tar and may not work well with other versions. DIAGNOSTICS
See the DIAGNOSTICS section for the smbclient(1) command. VERSION
This man page is correct for version 2.2 of the Samba suite. SEE ALSO
smbd(8) smbclient(1) smb.conf(5) AUTHOR
The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed. Ricky Poulten <URL:mailto:poultenr@logica.co.uk> wrote the tar extension and this man page. The smbtar script was heavily rewritten and improved by Martin Kraemer <URL:mailto:Martin.Kraemer@mch.sni.de>. Many thanks to everyone who suggested extensions, improvements, bug fixes, etc. The man page sources were converted to YODL format (another excellent piece of Open Source software, available at ftp://ftp.icce.rug.nl/pub/unix/ <URL:ftp://ftp.icce.rug.nl/pub/unix/>) and updated for the Samba 2.0 release by Jeremy Allison. The conver- sion to DocBook for Samba 2.2 was done by Gerald Carter. 19 November 2002 SMBTAR(1)
All times are GMT -4. The time now is 03:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy