ftp check for failed attempts


 
Thread Tools Search this Thread
Operating Systems AIX ftp check for failed attempts
# 1  
Old 01-24-2007
ftp check for failed attempts

Hi,

I have created the below ftp script to put files over to our capacity server, the check at the end works if ftp fails to run however if the script cannot login or the transfer itself failed there is no warnings.

Does anyone know the syntax to trap the erorr codes or to put a check within FTP?

Thanks a million ....

# create an ftp script to move the data to sftp

echo "ftp -v -i -n $SERV <<!EOF" > $FTP
echo "user capacity.ftp C@p@C1ty" >> $FTP
echo "binary" >> $FTP
echo "prompt" >> $FTP

# Find the processed nmon file to be sent to capacity server for processing:

cd $OUTDIR
PDATE=`perl -le '($year,$mon,$day,$hrs,$min)=(localtime(time()-$ARGV[0]))[5,4,3,2,1];printf "%04d%02d%02d_%02d\n",$year+1900,$mon+1,$day,$h
rs,$min' 3600`
TFILE=`ls ${NFILE}_${PDATE}*.csv`


if [ -f ${OUTDIR}/${TFILE} ] ; then

continue

else

logfile "$TFILE is not available for transfer, please investigate and transfer the file."
exit 1
fi


echo "mput $TFILE" >> $FTP
echo "$DATE:$TIME//Transfering $TFILE to $SERV " >> $PROGLOG
echo "!EOF" >> $FTP
chmod 777 $FTP

#$FTP

if [ $? -ne 0 ] ; then

logfile "failed to FTP $TFILE to $SERV"
fi
# 2  
Old 01-24-2007
In my code I have directed the output of the ftp process to a file and then interrigate the file for verbage.

ftp $rmthost <<COMMANDS>> $ftplog 2>&1

checkftp=`grep -c "Transfer complete" $ftplog`
if (($CHECKFTP > 0 )); then
mailx -s "error" me@mymailaddress < $ftplog
else
echo "ftp ok" > $joblog
fi
# 3  
Old 01-24-2007
take a peek here
# 4  
Old 01-26-2007
groovey!

thanks both for your help Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Cybersecurity

Failed SSHD Login Attempts (15,000 per day) - Is that a lot compared to your server?

The purpose of this thread is for everyone to follow the same methodology so we can create a future table, for the benefit of all, that shows how many failed login attempts (hacking) per day per server (and per minute) are happening. This is not a thread on writing scripts or creating... (10 Replies)
Discussion started by: Neo
10 Replies

2. Solaris

How to check FTP service failed in between on Solaris 10?

Hi Guys, I need to check why FTP service on Solaris 10 machine did not work in between. What does Jun-29 means here? Does it mean that it has been RUNNING/UP since Jun 29th ? -bash-3.2$ sudo /usr/bin/svcs |grep -i ftp legacy_run Jun_29 lrc:/etc/rc3_d/S90proftpd online ... (3 Replies)
Discussion started by: manalisharmabe
3 Replies

3. Solaris

Solaris logs - Tracking failed attempts from my host

Hey all I'm having a big problem here. Someone is attempting an SSH to a destination host on which an account resides and locking the account. I'm trying to determine who is performing the SSH attempts from my host. For instance they're logged in as their standard account but then (I'm assuming)... (13 Replies)
Discussion started by: MaindotC
13 Replies

4. UNIX for Dummies Questions & Answers

FTP failed

Hi All, We are using the following step to place a file in server using FTP STEP_EXECUTE STEP090 /usr/pjc/bin/FTP -i DATASET FTPIN $sic/ctl/ftpsic.ctl DISP=OLD,KEEP,KEEP STEP_END If we run this step we are getting the error. ftp> open arg.mnd.appsc.com Connected to arg.mnd.appsc.com.... (4 Replies)
Discussion started by: ajaykumarkona
4 Replies

5. Shell Programming and Scripting

automatic FTP failed

I have automated ftp for different scripts. every script uses different login and passwords for different server. it reads the username and password from netrc. there is 1 particular script that is failing. this script is failing in FTP step. i have checked the logs it says login failed. but... (5 Replies)
Discussion started by: dazdseg
5 Replies

6. UNIX for Dummies Questions & Answers

TCP failed connection attempts from netstat -s

Dear experts, I am seeing a lot of TCP failed connection attempts from "netstat -s" on one of our servers. How can I pin point what connection failed and what are the ports involved? Any tools/commands I can dig in deeper to diag. what went wrong on these "failed connection attempts"? ... (2 Replies)
Discussion started by: cache51
2 Replies

7. Solaris

FTP login failed.

Hi guys, Can you please help me. I have SUN V100 server running solaris 8. I also have a Redhat Linux 6.2 machine and a windows XP machine on the network. I'm trying to copy files from the Linux and XP machines to the V100 server. When I try to ftp to the solaris machine, I'm challenged... (2 Replies)
Discussion started by: Stin
2 Replies

8. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

9. AIX

Denying IPaddress for Multiple Failed Login Attempts

Hi. I would like to be able to deny IP address for too many failed login attemps (either from ssh, sftp, ftp, etc). The system I wish this to work on is an AIX 5.1 system. I'm new to AIX but I'm a linux user. There is a program for linux called fail2ban which reads from the log files and see if... (1 Reply)
Discussion started by: metzgerh
1 Replies
Login or Register to Ask a Question