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
- Windows 2003 Server with access to the Internet, all incoming ports besides Terminal Service closed
- 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?
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
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
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
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."
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!
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 ;-)