The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
scp automated script gholdbhurg UNIX for Advanced & Expert Users 5 10-27-2008 01:23 AM
automated sftp script klindel Shell Programming and Scripting 2 05-13-2008 01:45 AM
automated sftp procedure interrupted boyin.huang Shell Programming and Scripting 2 05-06-2008 11:07 AM
Need automated shell script please uneex Shell Programming and Scripting 2 05-02-2008 08:36 AM
help for automated script splax UNIX for Advanced & Expert Users 4 12-26-2006 05:36 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-21-2008
aggar_y aggar_y is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 3
Automated SFTP script

Hi All,

I am writing an automated SFTP script to xfer files. I am able to do sftp in batch mode and it is working absolutely fine.
The problem is that on redirecting the output of SFTP session to some file, it is not writing about the status of SFTP operation. All i can see in output file is :

sftp> put file2.dst2
Uploading file2.dst2 to /data05/FTP_test/dst2/file2.dst2

Whereas in interactive mode the output is :-

sftp> put file2.dst2
Uploading file2.dst2 to /data05/FTP_test/dst2/file2.dst2 file2.dst2 100% 4096 4.0KB/s 00:00

I need to know the status of the SFTP operation so as to rename the files successfully xferred...

Am i missing anything here ?? Please help..
  #2 (permalink)  
Old 01-21-2008
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,318
When running in batch mode, I don't think you have a way to catch the exit code of each operation. Instead, you can redirect everything to a log file and later grep for certain patterns like "fatal, error, couldn't" etc.
  #3 (permalink)  
Old 01-22-2008
aggar_y aggar_y is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 3
I am doing exactly that... but the log file is not writing anything after

Uploading file2.dst2 to /data05/FTP_test/dst2/file2.dst2

Is is normal sftp behaviour or am i missing something ??
  #4 (permalink)  
Old 01-22-2008
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,318
That's normal, I'm usually using "nohup" in front of every ssh transfer, the STDOUT by default gets redirected to file called "nohup.out" and then I look at this file, but I'm not sure if this is going to work in batch mode.
  #5 (permalink)  
Old 01-31-2008
vglass vglass is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 4
you might consider using the FTCL scripting language .. supports FTP/S and SFTP and allows you to send debug information to a file.

Secure FTP Factory - Java SFTP, Java Secure FTP, Java FTPS, Java FTP, FTP SSL, FTP SSH
  #6 (permalink)  
Old 02-20-2008
ckmehta ckmehta is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 12
I would say if you are scripting SFTP sessions, you should not use SFTP as your client program, but a generic FTP program called LFTP (LFTP - sophisticated file transfer program) using an SSH/SFTP protocol. Covers all sorts of FTP-ish protocols and has great shell scripting support
  #7 (permalink)  
Old 08-05-2008
rshah rshah is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 1
hi aggar_y
i am trying to implement the SFTP script in solaris. could you please send me the snippet of the code which is working for you?
Sponsored Links
Closed Thread

Bookmarks

Tags
sftp script

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:14 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0