Backup AD domain control files to linux servers via rsync under Windows

Source: Internet
Author: User
Tags rsync

Tools to use cwrsync:http://down.51cto.com/data/2103716


BAT script used on Windows:

@echo offset fdate=%date:~0,4%_%date:~5,2%_%date:~8,2%_%time:~0,2%_%time:~3,2% echo%fdate%ldifde-f%fdate%.ldfmove %fdate%.ldf d:\adbackup\addatad:\adbackup\command\cwrsync\rsync.exe--delete-az "/cygdrive/D/adbackup/addata" [ Email protected]::adbackup--password-file= "/cygdrive/d/adbackup/command/cwrsync/pass.txt"

Where bat takes the time variable as the file name:


"date:~0,10% is the command to take the date in DOS.

Echo: ~1,5%//pointer right → offset 1 bit, then start Right → Extract 5 characters from the pointer.

Echo: ~0,-3%//pointer does not offset, → extracts all characters and removes the last 3 characters.

Echo: ~5%//single digit, not specified length value. Represents pointer → offset 5 characters, and then → extracts all characters.

Echo: ~-5%//A single negative value, special case, which represents the inverse direction offset of the pointer, from the right end, ← Offset 5 bits, and then start at the pointer → extract all characters. It can also be simply understood to fetch 5 characters at the end of a string.

Example:

C:\Documents and Settings\user>echo%date%

2012-08-08 Wednesday

C:\Documents and Settings\user>echo%date:~5,10%

08-08 Week Three

C:\Documents and Settings\user>echo%date:~5,4%

08-0

C:\Documents and Settings\user>echo%date:~5,5%

08-08



Cwrsync Command Explanation:

Rsync.exe--delete-az "/cygdrive/d/adbackup/addata" [email protected]::adbackup--password-file=]/cygdrive/d/ Adbackup/command/cwrsync/pass.txt "

--delete-az de-sync to keep both ends of the file consistent

"/cygdrive/d/adbackup/addata" source file directory, representing D:/adbackup/addata

[Email protected]::adbackup adrsync for rsync backup username, rsync.xx.com for rsync server name, Adbackup for rsync module

--password-file= "/cygdrive/d/adbackup/command/cwrsync/pass.txt" Specifies the password file path of the rsync backup user name in the format similar to "Source file directory"



Rsync service configuration file (Linux):

[[email protected] rdata]# cat/etc/rsyncd.conf uid = rootgid = Root[adbackup]path =/adbackup/rdatacomment = Windows AD b Ackup dirlist = Yesauth user = Backusersecrets File =/abbackup/adrsync.passread only = no



Regular cleanup, server packaging and other operations no longer repeat!



This article is from the "Hoccboy" blog, make sure to keep this source http://hoccboy.blog.51cto.com/7189696/1701185

Backup AD domain control files to linux servers via rsync under Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.