FtpTail – Monitor the tail of a file via FTP

May 12, 2006

ftptail prints the last lines of a file stored on an FTP server and then monitors it for changes. (Similar to the Unix tail command)

I wanted to monitor the access logs for hamstersoup.com Unfortunately I can't run any scripts on the server, I can only access the files via FTP and I don't want to waste bandwidth downloading a 100KB log file every few minutes. My script ftptail solves the problem:

Example

ftptail -f -p passwd.txt will@hamstersoup.com/access.log

Command Line Options

Usage: ftptail [OPTIONS] user@host/file
Print the last 10 lines of file on an FTP server.

Options:
   -n, --lines=N           Print the last N lines of the file (default:10)
   -f, --follow            Keep FTP connection open and append as file grows
   -s, --sleep-interval=S  Sleep S seconds between updates    (default:200)
   -p, --password-file=P   Use the password stored in P to login
   -v, --verbose           Dump info about FTP connection to STDERR

Feedback

If you download ftptail and have problems or suggestions then leave a comment.
I'm surprised that I couldn't find another utility that does this. Maybe my Google-Fu failed me, please let me know about any existing tools.

Hope somebody finds this useful.

.

Advertisements