Backup Website Code、Database to Remote Server/Ftpserver Automatically

Part I backup plan and host info

A simple backup system plan

The main advantage of using FTP or NAS backup is a protection from data loss.

I am going to write about FTP backup solution here. The idea is as follows:

  • Make full backup every day night
  • Also we can backup only those files that has been modified since the full backup (incremental backup) as a seven-day backup cycle.

Our sample setup-this is a full backup demo

Local Server ===>>> Remote Server[ftp/nas server]

IP:192.168.1.10/192.168.1.11 ===>>> 192.168.1.12

Let us assume that your ftp details are as follows:

  • FTP server IP: 192.168.1.12
  • FTP Username: R_to+FTP-test
  • FTP Password:Pass_$$$$
  • FTP Directory: /bak (or /)

You will store data at remote server as follows:
=>> /bak/web/192.168.1.10/files mm-dd-yy - Full backup
=>> /bak/db/192.168.1.11/ files mm-dd-yy - Full backup

Local Server:Server A& Server B info

Server A :Website win2003 OS

ip:192.168.1.10

Website code path e:\website\longrujun.name

Server B :Database WIN2003+MSSQL2005

Ip:192.168.1.11

Database related info

E:\bak\Full

\Diff

\Logs

Remote Server:Server C info

Ftp server Account info win2003+Server-U

Ip:192.168.1.12

Username:R_to+FTP-test

Passwd:Pass_$$$$

Main Home Directory E:\bak

The detail architecture as the following describes

E:\bak\web:archive the ServerA’s website code

\db:archive the serverB’s database files

\logs:archive the web logs

Part II:Config

1、 backup website code to remote ftp server

ADownload the AutoRun.rar file on ServerA’s Disk F and extract

BOpen AutoRun folder and make 2 config files in run folder

web_to_remote.bat

======start====

rar a -m0 F:\Autorun\backup\10website%date:~2,2%%date:~5,2%%date:~8,2%.rar e:\website\longrujun.name

cd F:\Autorun\backup

F:

ftp -v -n -s:F:\Autorun\run\ftp10website.txt 192.168.1.12

del F:\Autorun\backup\*.rar /a /s /q /f

=======end=====

ftp10website.txt

=======start===

open 192.168.1.12

user R_to+FTP-test Pass_$$$$

cd web

cd 192.168.1.10

bin

prompt

mput *.rar

bye

========end====

Ok,now,pls add the web_to_remote.bat to scheduled task and run it a day

2、 backup database files to remote ftp server

the 2 steps as the upper ways

A、 Download the AutoRun.rar file on ServerA’s Disk F and extract

B、 Open AutoRun folder and make 2 config files in run folder

db_to_remote.bat

======start====

rar a -m0 F:\Autorun\backup\10website%date:~2,2%%date:~5,2%%date:~8,2%.rar E:\bak\Full

cd F:\Autorun\backup

F:

ftp -v -n -s:F:\Autorun\run\ftp11db.txt 192.168.1.12

del F:\Autorun\backup\*.rar /a /s /q /f

=======end=====

ftp11db.txt

=======start===

open 192.168.1.12

user R_to+FTP-test Pass_$$$$

cd db

cd 192.168.1.11

bin

prompt

mput *.rar

bye

========end====

The same as we should add the db_to_remote.bat to scheduled task and run it a day

你可能感兴趣的:(Web,windows,F#,OS,idea)