Sponsored Content
Full Discussion: SFTP Invalid IP
Top Forums Shell Programming and Scripting SFTP Invalid IP Post 302237230 by ronnie_uk on Wednesday 17th of September 2008 08:37:00 AM
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..
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
libssh2_sftp_rmdir_ex(3)					  libssh2 manual					  libssh2_sftp_rmdir_ex(3)

NAME
libssh2_sftp_rmdir_ex - remove an SFTP directory SYNOPSIS
#include <libssh2.h> #include <libssh2_sftp.h> int libssh2_sftp_rmdir_ex(LIBSSH2_SFTP *sftp, const char *path, unsigned int path_len); DESCRIPTION
Remove a directory from the remote file system. sftp - SFTP instance as returned by libssh2_sftp_init(3) sourcefile - Full path of the existing directory to remove. sourcefile_len - Length of the full path of the existing directory to remove. RETURN VALUE
Return 0 on success or negative on failure. It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. ERRORS
LIBSSH2_ERROR_ALLOC - An internal memory allocation call failed. LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket. LIBSSH2_ERROR_SOCKET_TIMEOUT - LIBSSH2_ERROR_SFTP_PROTOCOL - An invalid SFTP protocol response was received on the socket, or an SFTP operation caused an errorcode to be returned by the server. SEE ALSO
libssh2_sftp_init(3) libssh2 0.15 1 Jun 2007 libssh2_sftp_rmdir_ex(3)
All times are GMT -4. The time now is 04:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy