Help - Search - Members - Calendar
Full Version: Howto: Automatically FTP backups to backup space
The Planet Forums > Operating Systems > Microsoft Windows > Windows HOWTOs
gummyAvenger
Assuming you're putting these files in c:backup
Create a file called FTPBackup.bat that looks like this:

CODE
ftp -s:c:backupftpinfo.txt ftp.whatever.com


...or, if like me you want to back up your mysql database here too, make FTPBackup.bat look like this instead:

CODE
c:mysqlbinmysqldump -l --all-databases -a --user=root --password=mysqlrootpassword -r c:Backupmysqlbackup.sql

ftp -s:c:backupftpinfo.txt ftp.whatever.com


Now create a file called ftpinfo.txt (put it in the location referenced in FTPBackup.bat) :

CODE
ftpusername

ftppassword

CD /

binary

put c:backupmysqlmysqlbackup.sql

put c:backupdatabasehelmdb.cab

put c:backupdatabasehelmdb.dat

put c:backupmsbackupBackup.bkf

quit



CD / is changing to the directory that you want to upload to. add/remove/adjust the "put ..." lines to your liking... these are the files you're uploading. you can add "binary" or "ascii" in there before the different "put ..." lines if you need to.

Now test it out to make sure it's working and then set up FTPBackup.bat as a scheduled task.

Of course, now you've got the issue that your FTP password (and MySQL root password) are stored in plain text on the server. Make sure you've got the proper permissions on them (only Administrators, System).

Also, if your box gets hacked you've got the FTP password to the backup location in plain text. This could mean that the "hacker" could log in and delete your backups. There's a way to hide it from "hackers" so that they can't see your ftp login info, but I'd rather not get into the details of how I'm doing it on my box for obvious reasons. You'll just have to get creative about how you do it icon_wink.gif
JHCain
Your solution and .bat file is similar to mine. Minor tweak that I use is to keep 3 revs of backups on the backup server. As well, I don't reference the 2nd .txt file; all in one, as it were.

For reference:
====================

%windir%system32ftp.exe -s:%~f0
goto done
open backups.ev1servers.net
Login
Password
binary

del backup.3.bkf
ren backup.2.bkf backup.3.bkf
ren Backup.bkf backup.2.bkf
put Backup.bkf
bye
:done
@echo off
cls
exit

========================

I use the standard Windows backup utility to do backups two times per week, then Task Scheduler fires off the above .bat file a couple hours later to transfer the backup file off the server. Low budget, low impact, easy to deal with.

To use the above .bat, you'd need to replace "Login" and "Password" with your info, as well as change "Backup.bkf" to whatever file name your archive has.

Well, it works for me.

-Jim
rubensans
Hello:

This is the command to backup all databases:

c:mysqlbinmysqldump -l --all-databases -a --user=root --password=mysqlrootpassword -r c:Backupmysqlbackup.sql

Which is the one to restore them?

I supose that using this, nothing is changed in the databases, no? (With this I want to say, that I restore the databases like how they where).

Best Regards.
rubensans
mysqldump -uusername -p --all-databases --opt > all-databases.sql

This syntax will be better (with the --opt) ?

Whats the diference between puting "> mysqlbackup.sql" or "mysqlbackup.sql"

Best Regards.
instantnet
How about windows users and passwords located in SAM? I would think that this would be pretty important too.

Thanks
shacker
Also, if your box gets hacked you've got the FTP password to the backup location in plain text.

Seems kind of absurd that they don't allow SFTP access to the backup server, which would let you negotiate the connection with keypairs.
woodsman
Hey guys, is there any way to ftp a directory without compressing it into a single file using ftp.exe?

i.e. I want to upload c:inetpub as is. No rar/zip/bak etc.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.