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

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.

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.

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 .

Hi we are not having any error in control M Logs.

here are the scripts:--

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

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

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):

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