Sponsored Content
Full Discussion: SFTP issues
Top Forums Shell Programming and Scripting SFTP issues Post 302422684 by Amit.Sagpariya on Wednesday 19th of May 2010 06:33:42 AM
Old 05-19-2010
SFTP issues

Hi All,
To transfer the files, from one server to another through SFTP, i am using below code in my script.
Code:
 
cur_dt=$1
echo "cd /inbox/" >> SFTP.txt  # folder of traget server
echo "mput /opt/myfile/inbox/*_${cur_dt}_*.* " >> SFTP.txt # to get files from /opt/myfile for given date and transfer to target
sftp -B SFTP.txt user@server >> FileTransfer.log

I have 3 problems here.
1. The log file is contains all information produce by sftp command. For example, if one file is 149 MB in size, the log file will show following information about that file.
Code:
 
ABC.txt  | 8.8 MB | 1.5 MB/s | ETA: 00:01:35 |   5%
 ABC.txt  |  19 MB | 1.5 MB/s | ETA: 00:01:27 |  11%
 ABC.txt  |  28 MB | 1.5 MB/s | ETA: 00:01:21 |  18%
 ABC.txt  |  39 MB | 1.5 MB/s | ETA: 00:01:14 |  24%
 ABC.txt  |  47 MB | 1.5 MB/s | ETA: 00:01:08 |  31%
 ABC.txt  |  58 MB | 1.5 MB/s | ETA: 00:01:02 |  37%
 ABC.txt  |  67 MB | 1.5 MB/s | ETA: 00:00:55 |  44%
 ABC.txt  |  77 MB | 1.5 MB/s | ETA: 00:00:49 |  50%
 ABC.txt  |  86 MB | 1.5 MB/s | ETA: 00:00:42 |  57%
 ABC.txt  |  97 MB | 1.5 MB/s | ETA: 00:00:36 |  63%
 ABC.txt  | 106 MB | 1.5 MB/s | ETA: 00:00:29 |  70%
 ABC.txt  | 116 MB | 1.5 MB/s | ETA: 00:00:23 |  76%
 ABC.txt  | 125 MB | 1.5 MB/s | ETA: 00:00:16 |  83%
 ABC.txt  | 135 MB | 1.5 MB/s | ETA: 00:00:10 |  89%
 ABC.txt  | 144 MB | 1.5 MB/s | ETA: 00:00:03 |  96%
 ABC.txt  | 149 MB | 1.5 MB/s | ETA: 00:00:40 | 100%

I have total 96 files, and for each file, sftp command output as above in log file, which looks weired. Instead for each file, i need only
Code:
ABC.txt  | 149 MB | 1.5 MB/s | ETA: 00:00:40 | 100%

2. As given above i am using mput /opt/myfile/inbox. But there are more than one inbox folder with number. ie inbox0, inbox1...inboxn which is dynamic.
How to get all files from all inbox folder? I have tried using
Code:
/opt/myfile/inbox*/*_${cur_dt}_*.*

But it did not work.
3. How can i verify, the total number of files in source and target are same after SFTP?

Can someone help me on this?
Regards,
ACE
 

10 More Discussions You Might Find Interesting

1. Linux

sftp stalling issues.

Hello, I'm new to linux/unix and presently at my work i have wrote a script that goes out from a unix host connects to a transfer proxy using sftp (username & password) with internal IP address as scp is disabled on the server.. Now my problem is that when i try and get a bigger file sftp will... (1 Reply)
Discussion started by: est
1 Replies

2. AIX

SFTP Failed---Request for subsystem 'sftp' failed on channel 0

Hi, While I am trying SFTP my machine to another unix machine , it was working fine till 10 min back. But now i am getting the below error "Request for subsystem 'sftp' failed on channel 0" Could you please someone help me to solve or analyise the root cause... Cheers:b:, Mahiban (0 Replies)
Discussion started by: mahiban
0 Replies

3. Shell Programming and Scripting

SFTP / UNZIP script issues

Hi everyone, i'm having a little trouble wih my first shell script ever. So the point of that script is to: -Archive Zip files in a directory -Remove txt files from that directory -connect through sftp and a rsa key to a remote server -download a couple of files -unzip downloaded files ... (0 Replies)
Discussion started by: Peanutz
0 Replies

4. Solaris

Issues with automating SFTP

Hi We are trying to set up a non-interactive sftp to one of our clients to be able to transfer files to them. For the setup I logged into server1 as user1 and generated RSA public and private keys id_rsa and id_rsa.pub. Then I did an sftp to server2 as user2 and put the id_rsa.pub in the .ssh... (4 Replies)
Discussion started by: vnparo
4 Replies

5. Emergency UNIX and Linux Support

rm -rf issues

We are using the solaris server and if i am using rm -rf to delete the directories its asking the confirmation for each and every file inside the directory.Is there any way to disable ( should not ask the confirmation) only for a particular session? (12 Replies)
Discussion started by: sureshbabuc
12 Replies

6. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

7. Shell Programming and Scripting

Issues with automating SFTP command

Hi All, I am currently looking at automating the steps that I follow to download log files from putty to desktop. I connect to a client's machine through citrix desktop. I am required to download quite a number of application logs to identfiy the issues in production. Steps that is being... (3 Replies)
Discussion started by: krackjack84
3 Replies

8. Red Hat

Chroot sftp users, remote sftp login shows wrong timestamp on files

Hello, I have a weird issue, I have RHEL 5.7 running with openssh5.2 where sftpgroup OS group is chroot. I see the difference difference in timestamp on files, when I login via ssh and SFTP, I see four hour difference, is something missing in my configuration. #pwd... (8 Replies)
Discussion started by: bobby320
8 Replies

9. Shell Programming and Scripting

Sftp : not able to print the echo statements after the sftp transfer

I had the below sftp script working perfectly but the problem is I am not able to send the echo statements . #!/bin/sh echo "Starting to sftp..." sftp admin@myip << END_SCRIPT cd /remotepath/ lcd /localpath/ mget myfiles*.csv bye END_SCRIPT echo "Sftp successfully." echo echo... (11 Replies)
Discussion started by: scriptscript
11 Replies

10. Shell Programming and Scripting

Needed SFTP script from windows to UNIX server and from UNIX to windows server(reverse SFTP)

hi guys, i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not and again i have to reverse sftp the files from unix to windows server..... regards, Vasa Saikumar. (13 Replies)
Discussion started by: hemanthsaikumar
13 Replies
dos2unix(1)						      General Commands Manual						       dos2unix(1)

NAME
dos2unix - DOS/MAC to UNIX text file format converter SYNOPSYS
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRIPTION
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC format to UNIX format. OPTIONS
The following options are available: -h --help Print online help. -k --keepdate Keep the date stamp of output file same as input file. -q --quiet Quiet mode. Suppress all warning and messages. -V --version Prints version information. -c --convmode convmode Sets conversion mode. Simulates dos2unix under SunOS. -o --oldfile file ... Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used. -n --newfile infile outfile ... New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be used or you WILL lost your files. EXAMPLES
Get input from stdin and write output to stdout. dos2unix Convert and replace a.txt. Convert and replace b.txt. dos2unix a.txt b.txt dos2unix -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. Convert c.txt from Mac to Unix ascii format. dos2unix a.txt -c iso b.txt dos2unix -c ascii a.txt -c iso b.txt dos2unix -c mac a.txt b.txt Convert and replace a.txt while keeping original date stamp. dos2unix -k a.txt dos2unix -k -o a.txt Convert a.txt and write to e.txt. dos2unix -n a.txt e.txt Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. dos2unix -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt. dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me. AUTHORS
Benjamin Lin - <blin@socs.uts.edu.au> Bernd Johannes Wuebben (mac2unix mode) <wuebben@kde.org> MISCELLANY
Tested environment: Linux 1.2.0 with GNU C 2.5.8 SunOS 4.1.3 with GNU C 2.6.3 MS-DOS 6.20 with Borland C++ 4.02 Suggestions and bug reports are welcome. SEE ALSO
unix2dos(1) mac2unix(1) 1995.03.31 dos2unix v3.0 dos2unix(1)
All times are GMT -4. The time now is 06:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy