Capturing FTP log


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Capturing FTP log
# 1  
Old 11-06-2008
Capturing FTP log

I am trying to do the FTP using .netrc.In my .netrc file in $HOME dir i am placing the machine ip,user name and pwd.Then i am creating dynamically a file which contains the ftp commands.

My script is like below:
__________________________________
export REMOTE_DIR= <some path>
export LOCAL_DIR= <some path>
export source_file_name= <some path>
echo "bin" > /data1/command_ftp.txt
echo "cd $REMOTE_DIR" > /data1/command_ftp.txt
echo "lcd $LOCAL_DIR" > /data1/command_ftp.txt
echo "get $source_file_name" > /data1/command_ftp.txt
echo "bye" > /data1/command_ftp.txt
chmod u+x /data1/command_ftp.txt
ftp x.xxx.xx.xx < /data1/command_ftp.txt

But in this script i am not able to capture any log any where during the FTP.
If i am using the conventioanl methos of doing FTP using user id and password i am able to get the log.

generally to get the log we wite like this :

ftp -v -n x.xxx.xx.xx << cmd >> ftplog
user $USER_ID $PASSWD
cd $REMOTE_DIR
lcd $LOCAL_DIR
$mode
$direction $REMOTE_FILE $LOCAL_FILE
quit
cmd

How can i capture log in the script i am using .netrc file.
Even if i try like this i am not able to capture the log

ftp x.xxx.xx.xx < /data1/command_ftp.txt > ftplog

Please suggest me some way to do this
# 2  
Old 11-06-2008
Not sure exactly what you want to capture but you can try adding "2>>&1" so that Stderr is also output to the log.
# 3  
Old 11-06-2008
Why would you use 2>>&1 I always use 2>&1 what does the extra > do.
# 4  
Old 11-06-2008
Sorry you are correct. I must have fat fingered that one.
# 5  
Old 11-06-2008
where i need to add 2>&1 in my code
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for capturing FTP logs

I have a script #!/bin/bash HOST=ftp.example.com USER=ftpuser PASSWORD=P@ssw0rd ftp -inv $HOST <<EOF user $USER $PASSWORD cd /path/to/file mput *.html bye EOF the script executes sucessfully I need to capture the FTP logs to a logfile should contain FTP Login successful ... (1 Reply)
Discussion started by: rajeshas83
1 Replies

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

3. Shell Programming and Scripting

Capturing errors messages into log file

Can we capture and write all the error messages which were being displayed on the command prompt screen during execution of a program into a log file? If yes, can anyone please let me know on how to do it? I am using ksh and working on AIX server. Thank you in advance. (4 Replies)
Discussion started by: vpv0002
4 Replies

4. Shell Programming and Scripting

Capturing FTP logs

Hi Guys, I am trying to capture the FTP Logs in a log file. I am using the below code. ftp -d -n -v $Remote_Host << EOD > $Ftp_LOG; Since iam running the script in debug mode, i am able to see that the ftp is done and the file has been transferred. But the log file does not have... (7 Replies)
Discussion started by: mac4rfree
7 Replies

5. Red Hat

Help for capturing a URL from a line from large log file

Can someone please help me how do I find a URL from lines of log file and write all the output to a new file? For e.g - Log file has similar entries, 39.155.67.5 - - "GET /abc/login?service=http://161.120.36.39/CORPHR/TMA2007/default.asp HTTP/1.1" 401 3218 54.155.63.9 - - "GET... (2 Replies)
Discussion started by: rockf1bull
2 Replies

6. Shell Programming and Scripting

Capturing script output and input to log

Hi Is there a way that I can capture a shell script (both output and input) to a log file where I can analyze it? Thanks (6 Replies)
Discussion started by: nimo
6 Replies

7. Shell Programming and Scripting

Capturing log of a shell script

Hi, I have a script which does multiple tasks in sequence. When i execute the script, it runs and displays lot of messages for each of the steps on the console. Is there any way I can capture those messages and store it for audit purposes ? Best Regards, bornon2303 (2 Replies)
Discussion started by: bornon2303
2 Replies

8. Shell Programming and Scripting

Any suggestion on Capturing SFTP error in log ???

Hello All, I have searched the thread for capturing and got some suggestion but that is not working for me. I am trying to sftp to a window server from unix server and getting file there with out any issue .But i wan't to capture the error --in case a file is not exist in remote. Example :... (1 Reply)
Discussion started by: jambesh
1 Replies

9. UNIX for Advanced & Expert Users

Capturing failed FTP error

Hi All, Please check the below ftp related job, which is deleting the files from remote host. Problem is it is not capturing the ftp failure error, and the exit status is still '0' eventhough the deletable files are not present in remote location OR ftp credential are incorrect. ... (5 Replies)
Discussion started by: ganapati
5 Replies

10. Shell Programming and Scripting

capturing log

Hi below is my script which copies test file to each directory in the file and checks if the permissions are ok, but I am not able to capture the log of the output. here is the script #! /usr/bin/sh set -x cd /dir/of/files while read line do cp test.txt $line rm $line/test.txt done <... (3 Replies)
Discussion started by: mgirinath
3 Replies
Login or Register to Ask a Question