SFTP Invalid IP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SFTP Invalid IP
# 1  
Old 09-17-2008
SFTP Invalid IP

Hi,

I have an SFTP script which is called from another run script:

When the SFTP process is run we passed through an invalid ip address to check the error logging and to ensure everything is working as expected.

Below is a sample of the code in the script:

$RUNSOCKS /usr/local/bin/sftp -v -B /dev/fd/0 ${IP_ADDRESS} 2>&1 <<EOF
lcd ${LOCAL_DIR}
cd ${REMOTE_DIR}
mput ${FILES}
ls -l
quit
EOF

FTP_ERROR=$?

The result fo the SFTP script is as follows:
warning: Connecting to nn.nnn.nnn.nnn failed: Connection Refused
+ FTP_ERROR=0


Zero is not good. This means in return to my parent script I continue processing as normal as it believes nothing is wrong.

Does anyone know how I ensure that an error is returned to the parent script when an invalid IP address is supplied so that I can handle it correctly.

Thanks
Ron

Last edited by ronnie_uk; 09-17-2008 at 11:20 AM..
# 2  
Old 09-17-2008

If possible, use scp rather than sftp.

# 3  
Old 09-18-2008
Unfortunately I have written the process using SFTP and it is already in use on our Production system.

I assume the only option I have now is to read the log file that is generated and check for connection refused messages.

Thanks for your help anyway.

Last edited by ronnie_uk; 12-22-2008 at 09:35 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Invalid date

Hi, I have a function to calculate "yesterday" in format YYYYMMDD: desa_ev9 # date +"%Y%m%d" --date "-1 day 20180701" 20180630 desa_ev9 # date +"%Y%m%d" --date "-1 day 20180720" 20180719 desa_ev9 # date +"%Y%m%d" --date "-1 day 20190101" 20181231 desa_ev9 # date +"%Y%m%d" --date "-1... (2 Replies)
Discussion started by: augreen
2 Replies

2. Shell Programming and Scripting

Sftp : not able to print the echo statements after the sftp transfer

I had the below sftp script working perfectly but the problem is I am not able to send the echo statements . #!/bin/sh echo "Starting to sftp..." sftp admin@myip << END_SCRIPT cd /remotepath/ lcd /localpath/ mget myfiles*.csv bye END_SCRIPT echo "Sftp successfully." echo echo... (11 Replies)
Discussion started by: scriptscript
11 Replies

3. Red Hat

Chroot sftp users, remote sftp login shows wrong timestamp on files

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)
Discussion started by: bobby320
8 Replies

4. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

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)
Discussion started by: noobrobot
1 Replies

5. Shell Programming and Scripting

sftp Invalid buffer size

For the above one I am getting an error like Invalid buffer size ...Could some one help (3 Replies)
Discussion started by: infernalhell
3 Replies

6. Linux

Invalid Character

Hi, I am using a Perl script to generate a report file in Linux server. When my input data contains an invalid character which looks like hyphen after that my program is printing junk values in the report. Why that symbol is causing issue and is there a way to tell the server that this is a valid... (1 Reply)
Discussion started by: lawrance_ps
1 Replies

7. Shell Programming and Scripting

Invalid Command Name

I have telnet to a machine and executed some commands in it. pls see below : #!/usr/bin/expect spawn telnet 170.10.11.1 2100 expect "login:" send username\r expect "password:" send password\r expect "$" send "touch filetest\r" expect "$" send exit\r expect... (3 Replies)
Discussion started by: sudharsan23
3 Replies

8. Shell Programming and Scripting

op is invalid

In the following code a= echo $? echo $? Why the op is (2 Replies)
Discussion started by: lipun4u
2 Replies

9. Post Here to Contact Site Administrators and Moderators

invalid link

i follow on the https://www.unix.com/cfmgoogle.php?cx=partner-pub-6323928554267084%3Absye1r5tx7j&cof=FORID%3A10&q=solaris&sa=Search#907 https://www.unix.com/sun-solaris/ (4 Replies)
Discussion started by: Hank
4 Replies
Login or Register to Ask a Question