Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP script logging doesn't work

Status
Not open for further replies.

normntwrk

MIS
Aug 12, 2002
336
US
For the life of me I can't figure out why I can't get any ftp script on this AIX 5.2 server to log commands . I can use this same script on any other AIX box and it works just fine. Any thoughts appreciated, I've tried all types of shells , bsh, ksh, csh sh and doesn't make any difference. Also tried different methods of input to log such as $server >> /tmp/ftp.log <<eof . As soon as I remove the logging the script runs ok and I can watch the listing of the files on the ftpserver by using sh -x scriptname

#!/bin/ksh

username=ftpxxxx
password=ftpxxxx
server=192.168.xxxx.xxx

cat /dev/null >/tmp/ftp.log


ftp -n $server <<eof >>/tmp/ftp.log
user $username $password
cd datadir
prompt
ls 2PF*.dat
ls 2RF*.dat
ls 2HS*.dat
bye
eof
 
What about this ?
#!/bin/ksh
username=ftpxxxx
password=ftpxxxx
server=192.168.xxxx.xxx
exec >/tmp/ftp.log
ftp -n $server <<EOF
user $username $password
cd datadir
prompt
ls 2PF*.dat
ls 2RF*.dat
ls 2HS*.dat
bye
EOF

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thanks for the quick response, just tried it and it didn't make any difference
 
What about this ?
#!/bin/ksh
username=ftpxxxx
password=ftpxxxx
server=192.168.xxxx.xxx
echo "user $username $password
cd datadir
prompt
ls 2PF*.dat
ls 2RF*.dat
ls 2HS*.dat
bye
" | ftp -n $server > /tmp/ftp.log 2>&1

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I think what is happening is that when I enable any type of logging the actual FTP session part of the script does not run.

I did capture some logging by doing this

ftp -n $server >>$log 2>&1 <<eof

which basically just captured the commands that ran but not the listing of the files on the FTP server which would indicate to me that the FTP session didn't actually run

 
It ended up being so simple I fell pretty foolish, needed the -v flag for verbose

ftp -n -v $server <<eof >>/tmp/ftp.log
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top