FTP Login Error check


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP Login Error check
# 1  
Old 02-23-2012
Error FTP Login Error check

How can I add a check right after the FTP to see if the login id failed or not and echo an error description indicating login failed?

Here is my script:

Code:
ftp $HOST1 <<END_SCRIPT>>$TARGETLOGS/$LOGFILE
#ftp $HOST1 <<END_SCRIPT> 
cd idx
prompt
mget $PICKUPFILE*.txt
!cp $PICKUPFILE* $TARGETPATH/data/
bye
END_SCRIPT
echo 'Ended .....: ' $tdate >>$TARGETLOGS/$LOGFILE
exit 0


Last edited by mrn6430; 02-23-2012 at 12:49 PM.. Reason: Code tags
# 2  
Old 02-23-2012
Nothing AIX specific, moving... Also try the search function of the forum - there should be more similar questions most probably answered/solved.
# 3  
Old 02-23-2012
Error

Quote:
Originally Posted by zaxxon
Nothing AIX specific, moving... Also try the search function of the forum - there should be more similar questions most probably answered/solved.

Done that already. Found nothing. Need an expert answer please.
# 4  
Old 02-23-2012
Perhaps:
Code:
grep "Login incorrect" $TARGETLOGS/$LOGFILE

# 5  
Old 02-23-2012
Quote:
Originally Posted by methyl
Perhaps:
Code:
grep "Login incorrect" $TARGETLOGS/$LOGFILE


is there a command within the FTP i can say, if the login failed, echo "Login Failed" and page the primary on call basically.
# 6  
Old 02-23-2012
Quote:
Originally Posted by mrn6430
is there a command within the FTP i can say, if the login failed, echo "Login Failed" and page the primary on call basically.
FTP is very simple and stupid. It doesn't have if-fail-then-do-x. It barely has files.

You can check the return code of your FTP client, see if it succeeded or failed:

Code:
ftp $HOST1 <<END_SCRIPT>>$TARGETLOGS/$LOGFILE
#ftp $HOST1 <<END_SCRIPT> 
cd idx
prompt
mget $PICKUPFILE*.txt
!cp $PICKUPFILE* $TARGETPATH/data/
bye
END_SCRIPT
if [ "$?" -ne 0 ]
then
        echo "FTP failed!" $tdate >>TARGETLOGS/$LOGFILE
fi

echo 'Ended .....: ' $tdate >>$TARGETLOGS/$LOGFILE

# 7  
Old 02-23-2012
Quote:
Originally Posted by Corona688
FTP is very simple and stupid. It doesn't have if-fail-then-do-x. It barely has files.

You can check the return code of your FTP client, see if it succeeded or failed:

Code:
ftp $HOST1 <<END_SCRIPT>>$TARGETLOGS/$LOGFILE
#ftp $HOST1 <<END_SCRIPT> 
cd idx
prompt
mget $PICKUPFILE*.txt
!cp $PICKUPFILE* $TARGETPATH/data/
bye
END_SCRIPT
if [ "$?" -ne 0 ]
then
        echo "FTP failed!" $tdate >>TARGETLOGS/$LOGFILE
fi
 
echo 'Ended .....: ' $tdate >>$TARGETLOGS/$LOGFILE



this did not do anything.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

FTP log only shows FTP LOGIN FROM entry?

OS: Solaris 9 Configuration /etc/syslog.conf daemon.debug /etc/inetd.conf ftp stream tcp6 nowait root /usr/sbin/in.ftpd in.ftpd -A -l -d Found the ftp.log only generate those entries from other servers/hosts. Can we trace on all ftp entries either from/to the server? ... (6 Replies)
Discussion started by: KhawHL
6 Replies

2. Cybersecurity

Check login detail

As a root user i switch to a different user say "oratest". I would like to know the details like at what time did the switch ( su - oratest ) happen. Are there any logs to check this Thanks. (2 Replies)
Discussion started by: jjoy
2 Replies

3. UNIX for Dummies Questions & Answers

Check login details

As a root user i switch to a different user say "oratest". I would like to know the details like at what time did the switch ( su - oratest ) happen. Are there any logs to check this Thanks. (4 Replies)
Discussion started by: jjoy
4 Replies

4. Solaris

error message rmclomv ... SC Login Failure for user Please login:

Hello World ~ HW : SUN Fire V240 OS : Solaris 8 Error message prompts 'rmclomv ... SC login failure ...' on terminal. and Error Message prompts continually 'SC Login Failure for user Please login:' on Single Mode(init S) The System is in normal operation, though In case of rain, Can... (1 Reply)
Discussion started by: lifegeek
1 Replies

5. Solaris

Check systems login

Hi All, In Solaris 10, how can I check back who is login to the systems by telnet, ssh and ftp in success or failed. I already check on /var/adm/messages but no details for all this. Hope your can help. Thanks. (1 Reply)
Discussion started by: mailbox80
1 Replies

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

7. UNIX for Advanced & Expert Users

Check existence of a login

Hi everybody, I need to check in C program wether a given login is known on the system. Is there any system function that could do this ? So far, all I could find is getpwnam(), which answers my problem by parsing the local password database. But won't work if a user is authenticated by... (10 Replies)
Discussion started by: xavier054
10 Replies

8. UNIX for Advanced & Expert Users

FTP login problem

I've just configured a server to my network (setting the ip, netmask, host file, etc...) and the server doesn't have any problem pinging another computer on the network. however when i try to connect to the server via ftp the root account can't log in, i made another account (a standard one that... (2 Replies)
Discussion started by: pasalagua
2 Replies

9. UNIX for Dummies Questions & Answers

Automated FTP to variable directory with error check

Hi, automated FTP that have error check and each product FTP will used the same userid/password to post(transfer) the file(s) from their <product> directory at UNIX to their <product> folder at Windows. such senarios as follows: NOTE: ======= ** Variable ** * The <product> is variable... (3 Replies)
Discussion started by: songtam
3 Replies

10. UNIX for Dummies Questions & Answers

FTP login failing

Please help. I am running Solaris 8 trying to get my FTP to work. When I try to access the FTP server from another computer on the network, it connects and prompts for a password. The username and password I set up do not work as well as my root account. Neither of the accounts are set up in the... (3 Replies)
Discussion started by: zbis12
3 Replies
Login or Register to Ask a Question