SFTP problem......File not getting from Remote server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SFTP problem......File not getting from Remote server
# 1  
Old 12-09-2013
Wrench SFTP problem......File not getting from Remote server

Hi,
We are using one unix script which is using sftp command and connect to remote server and get some file form remote server.

some time after running this script we are not getting any file .

Could you please tell us detailed validation that is there any problem with SFTP command?

Mahesh
# 2  
Old 12-09-2013
Hello.

Your problem description is quite vague.

What does "some time..." mean? The script hangs? Three weeks ago?

Do you get an error?

How is the script being run (manually v. cron)?

Etc.
# 3  
Old 12-09-2013
We are not getting any error.
this scripts is running through CONTROL M JOB Sechedular.
1 week back we did not got file from remote server.
this job is running everyday and we are having this issue first time.
# 4  
Old 12-09-2013
are there any condtion in th sftp script ? if so u can strt checking whether those conditions are fulfilled during the sftp can u check the control m log files for the error i.e if the script has successfully executed .
# 5  
Old 12-09-2013
Hi we are not having any error in control M Logs.

here are the scripts:--
Code:
sftp -v $USER@$ftpHost <<EndFTP > $LOG 2>&1
       get $source $target
     bye
EndFTP
# check for successs/failure
  RC=0
  if [[ ! -f $LOG ]]; then
        echo "Missing $LOG"
        RC=-1
  else
        grep "Could not resolve hostname" $LOG
        RC1=$?
        if [ $RC1 -ne 1 ]; then
            rm -f $LOG
            exit 19
        else
                egrep '(No such file or directory|Permission denied)' $LOG
                RC1=$?
                print "RC1 is $RC1"
                if [ $RC1 -ne 1 ]; then
                        rm -f $LOG
                        exit 20
                fi
        fi
      fi
  rm -f $LOG


Last edited by Scott; 12-09-2013 at 08:17 AM.. Reason: Please use cdd tags
# 6  
Old 12-09-2013
Hi
why don't you add a condition in the script to check for existence of files before doing sftp and getting the files also . can you try to execute it manually and do cat of the log here so
# 7  
Old 12-19-2013
Hi ,
we are not having any problem in script.

this scripts fail only 1 time and in control M log there was no any error.

and we are deleting log file in the end of this scripts.

we are not able to reproduce this issue in test?
could you please tell me may sftp connection failed ar network issue?
please tell me waht condition should i write to avoid this condition.

below are the scripts (some part of scripts):
Code:
if [[ ! -f $LOG ]]; then
        echo "Missing $LOG"
        RC=-1
  else
        grep "Could not resolve hostname" $LOG
        RC1=$?
        if [ $RC1 -ne 1 ]; then
            rm -f $LOG
            exit 19
        else
                egrep '(No such file or directory|Permission denied)' $LOG
                RC1=$?
                print "RC1 is $RC1"
                if [ $RC1 -ne 1 ]; then
                        rm -f $LOG
                        exit 20
                fi
        fi
      fi
  rm -f $LOG


Last edited by Franklin52; 12-19-2013 at 07:24 AM.. Reason: Please use code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with moving files on remote server using sftp

I need to sftp a file ABC_sysdate.csv (File name with system date and timestamp) to a temporary directory on the remote server and once the file is copied I've to move the file from temporary directory to the main directory with the same name. I have to generate a new file every hour and repeat... (6 Replies)
Discussion started by: srinup
6 Replies

2. UNIX for Advanced & Expert Users

SFTP from remote server

Hi All,While sftp from remote server an error (/) is coming before the file in a script.Please find the below log. The file is on home directory on remote server. (6 Replies)
Discussion started by: kiranparsha
6 Replies

3. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

4. UNIX for Dummies Questions & Answers

Get filelist.txt from a sftp remote server

Hi everyone, so I have a script create a login file to log into the sftp remote server, go to a certain directory and get the list of files in that direction into a text file in another folder (local folder). Here is the piece of code echo "#!/usr/local/bin/expect -f" >>... (5 Replies)
Discussion started by: warmboy610
5 Replies

5. Shell Programming and Scripting

Problem in appending text to a file located in remote server

ssh -q "server_name sudo echo 'dbagroup::1234' >> sudo /etc/group"if i execute the above code its not getting appended. my requirement is to login to remote server and append dbagroup::1234 in /etc/group i am able to achieve this with tee -a command want to know why its not working with >>... (5 Replies)
Discussion started by: chidori
5 Replies

6. Shell Programming and Scripting

SFTP - Get size of file on remote server

Hi, I have a requirement where I need to do SFTP connection to remote server, get the size of the file on remote server and depending on the size, i need to get the file onto local server. Is there any command in SFTP to get the size of the file. I found one in FTP but not in SFTP (2 Replies)
Discussion started by: forums123456
2 Replies

7. Programming

SFTP from one remote server to another remote server from desktop

Hi, I have 1. lappy 2. server A 3. server B Now, what i need is to run a command from lappy that will sftp a file from server A to server B. Please guide me to achieve this. -akash (1 Reply)
Discussion started by: akash.mahakode
1 Replies

8. Shell Programming and Scripting

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... (2 Replies)
Discussion started by: govindts
2 Replies

9. Shell Programming and Scripting

SFTP setting with a remote server - need help

Hi All, i want to setup a STPF setting to a remote server. Could you please help on this. The setting i have done but its still asking for password. Could anyone throw some light on the same? Thanks in advance. Pankaj (1 Reply)
Discussion started by: panknil
1 Replies

10. Shell Programming and Scripting

Use cURL in shell script and get most recent file from remote server using SFTP

I have been trying to implement the following shell script -- sftp to remote server get list of files in the directory sftp get the most recent listed file exit This script will be scheduled to be executed everyday using CRON or CONTROL-M and the need is to have absolutely no human... (7 Replies)
Discussion started by: toobrown1
7 Replies
Login or Register to Ask a Question