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
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
In the following code
a=
echo $?
echo $?
Why the op is (2 Replies)
Discussion started by: lipun4u
2 Replies
3. Shell Programming and Scripting
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
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
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
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
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
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
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
LEARN ABOUT DEBIAN
net::sftp::foreign::compat
Net::SFTP::Foreign::Compat(3pm) User Contributed Perl Documentation Net::SFTP::Foreign::Compat(3pm)
NAME
Net::SFTP::Foreign::Compat - Adaptor for Net::SFTP compatibility
SYNOPSIS
use Net::SFTP::Foreign::Compat;
my $sftp = Net::SFTP::Foreign::Compat->new($host);
$sftp->get("foo", "bar");
$sftp->put("bar", "baz");
use Net::SFTP::Foreign::Compat ':supplant';
my $sftp = Net::SFTP->new($host);
DESCRIPTION
This package is a wrapper around Net::SFTP::Foreign that provides an API (mostly) compatible with that of Net::SFTP.
Methods on this package are identical to those in Net::SFTP except that Net::SFTP::Foreign::Attributes::Compat objects have to be used
instead of Net::SFTP::Attributes.
If the ":supplant" tag is used, this module installs also wrappers on the "Net::SFTP" and Net::SFTP::Attributes packages so no other parts
of the program have to modified in order to move from Net::SFTP to Net::SFTP::Foreign.
Setting defaults
The hash %Net::SFTP::Foreign::DEFAULTS can be used to set default values for Net::SFTP::Foreign methods called under the hood and otherwise
not accesible through the Net::SFTP API.
The entries currently supported are:
new => @opts
extra options passed to Net::SFTP::Foreign constructor.
get => @opts
extra options passed to Net::SFTP::Foreign::get method.
put => @opts
extra options passed to Net::SFTP::Foreign::put method.
ls => @opts
extra options passed to Net::SFTP::Foreign::ls method.
COPYRIGHT
Copyright (c) 2006-2008, 2011 Salvador Fandin~o
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-05-04 Net::SFTP::Foreign::Compat(3pm)