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
SFTP setting with a remote server - need help panknil Shell Programming and Scripting 1 1 Week Ago 04:03 PM
Use cURL in shell script and get most recent file from remote server using SFTP toobrown1 Shell Programming and Scripting 7 09-10-2009 02:39 PM
Checking a file on a remote windows server Keepcase SUN Solaris 13 03-19-2009 05:59 PM
Checking for availability of remote server dylanmilks Shell Programming and Scripting 4 03-01-2007 12:08 PM
Checking for availability of remote server dylanmilks IP Networking 1 02-22-2007 07:48 PM

Reply
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 1 Week Ago
govindts govindts is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 63
Checking the file in remote server using SFTP

Hello, I would appreciate if any one can help me on this.

The below script start running at 12:30AM. Every 5 min, i go and check the remote site. If i see filewatch.txt over there, then i need to call another shell script and load the data into database. If i don't see that file, then i have to loop for one hour(sleep 5 every iteration) and keep check the filewatch.txt. If i don't find at 1.00AM, then send email to entire team.

Here is the below script.

Code:
while true
do
sftp dmchain@xyz.com
cd /hqspool/scc02505/DATA/B1P/outbound/datafiles/report
if [ -f filewatch.txt ]
then
echo "file found"
else
echo "file  not found"
fi
exit
done
This script is not working... It is hanging.. But i am able to connect manually and sftp the files...

Here is the output of the above script...

Code:
uixpad01(orcl) /odsimp/apps/xyz
==> sh gt.sh
Connecting to xyz.com...
Am i missing anything here... Please advise...
  #2 (permalink)  
Old 1 Week Ago
jsmithstl jsmithstl is offline
Registered User
  
 

Join Date: Oct 2009
Location: St. Louis, MO
Posts: 34
Once you're logged in just do:

sftp myname@myftpserver
cd mydir
ls ${FILENAME}
bye

If it's there it will list it.
  #3 (permalink)  
Old 1 Week Ago
govindts govindts is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 63
Thank you. My problem solved...[color="#738fbf"]

Last edited by govindts; 1 Week Ago at 09:12 PM..
Sponsored Links
Reply

Bookmarks

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 10:38 PM.


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