| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:to:from:subject:date:message-id:references | |
| :mime-version:content-type; q=dns; s=default; b=DpOXJovVVHzop5Lc | |
| cGl86czNk1byzpv5E4kcyEXmGRIMYY29uaUIguFMHLa1dS2QAQiZmZlrZSpJpoZj | |
| vHXrXN23d8Zl+F3K6z3iyj5iH6XRs/QohfTIGi5+z6KMcYUWouVLFnDHKrABrJFl | |
| M/Jgs+E6QlrAAzayqYas+JREYSE= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:to:from:subject:date:message-id:references | |
| :mime-version:content-type; s=default; bh=xk+p9EO7aG8ZIv9y13yAtu | |
| /FRaM=; b=ZOWwfj5lEOG0iB0CYS29aI51XaLaHLlhdz+36s7H1Clo1upUArCdxR | |
| KnQ5bPwV5L2gDqst4RoMS+sei8RfWD/+LlZi790UweDWhPGk2aPyPqm2hB+fP2sQ | |
| gCMYUAZ47DczBwnlixZtNYF8cbOcYzHly/KdC/D6GIQWxtDpci7SY= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=0.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,KAM_OTHER_BAD_TLD autolearn=no version=3.3.2 spammy=H*r:Unknown, DATE, Experiments, nol |
| X-HELO: | blaine.gmane.org |
| To: | cygwin AT cygwin DOT com |
| From: | Oleksandr Gavenko <gavenkoa AT gmail DOT com> |
| Subject: | Re: Recursively recreate hierarchy with NTFS hardlinks by Cygwin |
| Date: | Wed, 02 Aug 2017 16:26:45 +0300 |
| Lines: | 97 |
| Message-ID: | <8660e614oa.fsf@gavenkoa.example.com> |
| References: | <86efsu19xs DOT fsf AT gavenkoa DOT example DOT com> <86a83i195i DOT fsf AT gavenkoa DOT example DOT com> |
| Mime-Version: | 1.0 |
| User-Agent: | Gnus/5.13 (Gnus v5.13) Emacs/25.2 (windows-nt) |
| X-IsSubscribed: | yes |
On 2017-08-02, Oleksandr Gavenko wrote:
> Experiments shown that my goal can be archived in single command:
>
> mkdir orig
> echo 1 >>orig/my.txt
>
> mkdir backup
> rsync -a orig/ backup/1
> rsync -a --link-dest=../1 orig/ backup/2
>
> echo 2 >>backup/2/my.txt
> cmp backup/1/my.txt backup/2/my.txt && echo ok
> cmp orig/my.txt backup/2/my.txt || echo ok
``fsutil`` is built-in Windows utility:
bash# fsutil hardlink list backup/2/my.txt
\home\tmp\backup\1\my.txt
\home\tmp\backup\2\my.txt
bash# mv backup/1 backup/3
bash# fsutil hardlink list backup/2/my.txt
\home\tmp\backup\3\my.txt
\home\tmp\backup\2\my.txt
That is additional proof of work.
My bash backup script looks like:
LOG=/cygdrive/c/home/backup/backup-job.log
DST=/cygdrive/d/backup
DATE=`date +%F`
COMMON_RSYNC_OPT=( -a --delete )
log() {
echo `date +'%F %T'` "$@" >>$LOG
}
backup_simple() {
local SRC=$1
local BASE=${SRC##*/}
if [ ! -d $SRC ]; then
log "$SRC does not exist, leave"
return
fi
if [ -d $DST/$BASE/$DATE ]; then
log "$SRC is already backuped to $DST/$BASE/$DATE"
return
fi
if [ ! -d $DST/$BASE ]; then
mkdir -p $DST/$BASE
fi
local LAST=`cd $DST/$BASE; find . -maxdepth 1 -type d | grep '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}' | sort -r | head`
local RSYNC_OPT=( "${COMMON_RSYNC_OPT[@]}" )
if [ -n "$LAST" ]; then
RSYNC_OPT+=( --link-dest=../$LAST )
fi
rsync "${RSYNC_OPT[@]}" $SRC/ $DST/$BASE/$DATE/
log "$BASE is backuped"
}
backup_simple /cygdrive/c/home/devel/soapui
backup_simple /cygdrive/c/home/devel/postman
================================================================
What options is recommended for using Cygwin's rsync?
Backuped files don't need to preserve permission, ACL, etc. The goal is to
preserve hierarchy and content and make backuping lightweight (with
timestamps/size checks and hardlinks).
I collected list of:
-t --no-p --no-l --no-acls --no-o --no-g --no-D -O -J -m --no-partial --delete
to ignore most of file meta-information and make time/size bases checks.
================================================================
What is the better way to schedule backup task?
I've got familiar with Windows Task Scheduler, it has interesting options:
* run task as soon as possible after scheduler start is missed
* stop task if it runs longer then
* wake the computer to run this task
Do I need to bother with Cygwin CRON?
--
http://defun.work/
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |