How to automate backup from Windows Server to ftp server

by Volker Weber

I am trying to create a daily backup of two relatively small but essential directories of a Windows 2003 Server using ftp. How would you solve this on Windows?

Scenario: 2 Servers

  1. Windows 2003 Server with access to the Internet, all incoming ports besides Terminal Service closed
  2. Linux Server on the Internet, all incoming ports besides FTP closed

Task: Create a daily full backup from two directories on server 1 to compressed archives on server 2. Archives should be named by date, like foo080714.zip and bar080714.zip.

How would you automate this?

Comments

Nero BackItUp can do FTP backups. :) I don't know about the other task requirements however, never used it myself expect when I had to help others who wanted to do something with the software.

How or with what? I believe SyncBack would do the job. There's been a tutorial on Lifehacker for the free version.

I was told rsync can do everything... or I'm wrong?

Volker Jürgensen, 2008-07-14 17:15

I would use the AT command to schedule a backup that runs something like this:
-- begin batch file --
@echo off &setlocal enableextensions
for /f "tokens=1-3 delims=./-" %%f in ("%date%") do (
set today_=%%h%%g%%f
set dd_=%%f
set mm_=%%g
set yyyy_=%%h)
echo %today_%
echo dd_=%dd_% mm_=%mm_% yyyy_=%yyyy_%

:: Insert youor backup routine here, using %today_%.ext as the filename to back up to

:: Insert your method of transferring files here

for %%v in (today_ dd_ mm_ yyyy_) do set %%v=
endlocal &goto :EOF
-- end batch file --

I'd be tempted to ditch FTP and use SSH for transfer. FTP is notoriously insecure, to say the least...

I'd use SSH as the transfer mechanism, get myself an SSH keyfile onto the Windows box and a copy of PSCP from the PuTTY project (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html), and upload the files there.

However, if you're dead set on transferring via FTP, you could amend the batch file to use echo statements to build a "transfer.txt" file that does the FTP open/transfer script, and contains the correct filename based on the environment variable %today_%. Just add the line "ftp

Bah! My answer got truncated!

I'll send you an email tonight, just in case. :-)

(Plus I can add corrections, and further information!)

Although not specifically about using FTP, this article suggests an interesting approach to this kind of off-site backup, which may be of interest => http://www.smallnetbuilder.com/content/view/30171/77/

create a schedule and use cmd line version of rar
then use ftp.exe with script (usualle dont work very well for x64) if x64 use filezilla

assuming security isnt a requirement

and if they are small use drivehq free for 1gb

Flemming Riis, 2008-07-14 18:26

I use SyncBack for similar tasks. I schedule the task to do date specific backups, but run it more than once per day. If a file has been omitted (e.g. network timeout) it would be updated.
Absolutely love it.

you can use opensource software, 7zip and filezilla or ftp.exe, look here for sample using 7zip and date:

http://dotnetfish.blogspot.com/2008/07/zip-ftp-database-for-backup-purposes.html

juan sanchez, 2008-07-14 18:52

use Philip's to create the file

conent of vowe.txt

open ftp.vowe.somewhere
user vowe
this is not my pass
cd wheretoput
put file1
put file2
quit


ftp -s:vowe.text

if you need errorhandling you can use errorlevel to see the result

Flemming Riis, 2008-07-14 18:56

I have been using Cobian Backup for a couple of years and it has always worked perfectly.

Look at rsnapshot http://www.rsnapshot.org

"rsnapshot is a filesystem snapshot utility based on rsync. It makes it easy to make periodic snapshots of local machines, and remote machines over ssh. It uses hard links whenever possible, to greatly reduce the disk space required."

Bill Brown, 2008-07-14 19:48

Is it just me or did you forget some kind of encrypton in this scenario?

Do you have shell access on the Linux server?

Get JungleDisk and automate it completely. Cross platform, uses Amazon S3 for storage, which is very reliable and dirt cheap.

+1 for JungleDisk. I’m using it for my off-site back-up needs, and it’s very nifty.

I second SyncBack - brilliant!

Colin Williams, 2008-07-15 01:14

i would'nt do it with FTP (plain passwords, etc.)!! NO Way. But if so you could do it all within Windows Server itself.
- Task-Scheduler #1 packs the package or directory or whatever
- Task-Scheduler #2 does "ftp put" package.
- both Tasks could combiened with "Backup für Faule" Script from heise.de ;-)
- both Tasks can prepared in two Batchfiles:
pack.cmd: zip *.* > package.zip (short version of the comandline)
ftpcopy.cmd: ftp put package.zip
- run Batchfiles as sheduled Tasks on wich time you want.

the good point: you can see within the Eventviewer if the Backup was Ok or not... without paying any Software extra or so ;-)

Henrik Heigl, 2008-07-17 23:37

Post a comment











Shall I remember this for you?




Use your full name and a working email address. Unless you want your comment to be removed. No kidding.



Ceci n'est pas un blog

vowe.net is a personal website published by Volker Weber a.k.a. vowe. I am an author, consultant and systems architect based in Darmstadt, Germany.

rss Click here to subscribe

Hello

About me
Contact
Publications
Certificates
Frequently asked questions
Join the network

Twitter Updates

More >

Poll

Which Smartphone do you want?

Getting poll results. Please wait...

Local time is 04:11

visitors.gif
80 visitors online

News

Other sources of news, imported into my own format to make them more accessible:

Heise Online
Schlagzeilen
Weather

Archives

As most of my articles roll off the front page rather quickly, I am making an archive of previous posts available here. You can also use the handy search box at the top of the page if you are looking for something particular.

Last 30 days
More archives

Got the T-shirt?

Got the T-shirt?

Systems Architecture

This site runs on an Apache web server on top of the Linux operating system. The content is managed with MovableType which is implemented in Perl. Last but not least the HTML code your browser sees is put together with PHP.

© 1992-2009 Volker Weber.
All Rights Reserved.

Impressum