ftp backups

Hi,

I've been reading up on how to fetch the backup files from the MK to a server. I must be missing something though, because when I try the mget *.backup, nothing happens. I've read through various forum posts and scripts and they all seem alike, but I can't get it to work. Basically, I created the ftp user, I can log in through the ftp account, but when I try the mget command, it doesn't pull the file to the server.

I tried this script I found while searching around:


#!/bin/bash

Script to Download Backups

For all Variables and Archives

FTP_HHOST=0
FTP_USER=0
FTP_PASS=0
MKFILES=0

General Configuration

Server

ARCHIVE="*.backup"
FTP_HOST="<< IP >>"
FTP_USER="ftp"
FTP_PASS="<< password >>"
MKFILES="/backup/Server/"
cd $MKFILES

\

FTP Download Archives

cd $MKFILES
ftp -n $FTP_HOST <<EOF
quote USER $FTP_USER
quote PASS $FTP_PASS
binary
mget $ARCHIVE
bye
EOF


Even if I log into the ftp manually and test it out, the file never downloads to the server. Am I missing a config router-side or in the server?

Thanks in advance!

You need to turn off interactive prompting for multiple file downloads.
To do this change
ftp -n $FTP_HOST <<EOF
to
ftp -in $FTP_HOST <<EOF

You should also take out one of the H’s in
FTP_HHOST=0
Just for the sake of clean code.

-Louis

Thank you, Louis.

I made the change and corrected the typo, but it’s not fetching the file. =( I’ve tried to do it without the script, but it’s not working that way either. It doesn’t give me any error messages either so it’s a little difficult to figure out what’s missing or what could be wrong. Any other suggestions?

I tested the script using CentOS/Redhat Enterprise Linux 5.4.

See if doing an ftp -h give you any help. Maybe the command line options are different.

Does the Mikrotik show the user logging in at all after running the script?

Also, I do not know how familiar you are with *nix. Do you have ftp client installed? Have you set the execute bit on your bash script. Are you sure you are running the bash script properly?

-Louis

vsftpd is installed. I can see the ftp user log in the mikrotik and then it logs right back out, so the script is running.

What distro are you using?
Vsftpd is a ftp server not a client.
What about output for ftp -h ?
-Louis

That’s what was wrong, I’m guessing. I thought vsftpd was client too. I downloaded gftp and it works now!

=) Thank you very much for your time and help, Louis.