Please see the below shells script for SFTP.
if ” techoutheh.dat” and “teckeytluc.dat” files are available in ${OUTDIR} directory location it is working fine.
Problem:- for -ve testing, if the above files are not available it should give error, but it is not giving any errors(giving status is ‘0' always).
Actually I don't know stderror for SFTP .
I mean to say whether files are exits or not it is giving me always exit status is ‘0'(success) that I have tested.
Can any body tell me how to trap the success or failure in SFTP. ---------- Post updated at 04:37 AM ---------- Previous update was at 01:34 AM ----------
Hi,
I have posted shells script. please check.
Thanks,
krupa
---------- Post updated at 06:23 AM ---------- Previous update was at 04:37 AM ----------
Hi All,
are you able to see my thread. if it is not visible please let me know... still i am looking foe solution.
does the if part get executed? I have doubts on the second EOF...
It would be easier to rewrite your script using what sftp allows / has to offer like -b batchfile where you can write a script that can look for the presence of files etc...
Last edited by vbe; 12-19-2013 at 10:40 AM..
Reason: added doubts about second EOF...
Sorry, when i posted first time unfortunately i forget to post the code/program. after that i tried to delete the thread. but couldn't find the delete option. so i posted new thread.
sorry, i will keep in mind for the future.
Thanks,
krupa
---------- Post updated at 02:39 AM ---------- Previous update was at 12:06 AM ----------
Hi,
if part is executing, but it is giving the same result(output indicator 0 always eventhough it sftp is unsuccess).
as per your given instruction i tried with below.
it is giving me error like below.
is there any way?.
please let me know i am stoke at that point, not able to go ahead.
Thanks,
Krupa
Last edited by Scott; 12-20-2013 at 07:18 AM..
Reason: Code tags
-b batchfile
Batch mode reads a series of commands from an input batchfile
instead of stdin. Since it lacks user interaction it should be
used in conjunction with non-interactive authentication. A
batchfile of '-' may be used to indicate standard input. sftp
will abort if any of the following commands fail: get, put,
rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, chown, chgrp,
lpwd, df, and lmkdir. Termination on error can be suppressed on
a command by command basis by prefixing the command with a '-'
character (for example, -rm /tmp/blah*).
I have a problem when i try to create a log file from a daemon process using shell scripting in ubuntu 12. Ultimatly what i want to achieve is run a java/jar file from a script. After scourging the internet i found several solutions to do this, the one i choose is to create a startup script that... (4 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
That is the last reply I received from my instructor, and I'm looking for some alternatives.
When using... (2 Replies)
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)
Hi,
I've been using the following commands in my automated scripts, to ensure that all text output is sent to a log file instead of to the screen:
exec 1>>$SCRIPT_LOG_FILE
exec 2>>$SCRIPT_LOG_FILE
However, I've now discovered that the system used for automating the script executions... (4 Replies)
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)
when writing a script, when redirececting a message to stderror, how do i do it?
i can have
echo "message" 2> error.log
is it neccessary to do it while creating a file, if not how do i send it to stderror and have it displayed on the screen at same time, and not have to create a file. (5 Replies)
Hi folks,
I have tried to add some trap detection in the below script....this script is used to monitor database activities...in a rather awkward way :rolleyes:....
The idea behind adding trap is that....this script creates lots of temporary files in the running folder to store the count... (1 Reply)
Hello all,
I'm hoping to get a little insight from some of the wily veterans amongst you.
I've written a script to check for new outgoing files to our vendors located on our ssl server. It seems to be working ok, but the final question here, will be one of logic, and/or a better way to... (4 Replies)