From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20688 invoked by alias); 2 Aug 2017 13:26:57 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 20367 invoked by uid 89); 2 Aug 2017 13:26:57 -0000 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 Received: from Unknown (HELO blaine.gmane.org) (195.159.176.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Aug 2017 13:26:55 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dctfi-0007Qi-7o for cygwin@cygwin.com; Wed, 02 Aug 2017 15:26:46 +0200 To: cygwin@cygwin.com From: Oleksandr Gavenko Subject: Re: Recursively recreate hierarchy with NTFS hardlinks by Cygwin Date: Wed, 02 Aug 2017 13:26:00 -0000 Message-ID: <8660e614oa.fsf@gavenkoa.example.com> References: <86efsu19xs.fsf@gavenkoa.example.com> <86a83i195i.fsf@gavenkoa.example.com> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (windows-nt) X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00029.txt.bz2 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