Skip to content

Instantly share code, notes, and snippets.

@CTimmerman
Last active January 19, 2016 11:00
Show Gist options
  • Save CTimmerman/4cd31ad46939b46da162 to your computer and use it in GitHub Desktop.
Save CTimmerman/4cd31ad46939b46da162 to your computer and use it in GitHub Desktop.
Scheduled rsync backup in Windows 10 scheduled task
# Use LF EOLs, not CRLFs, or backup folder might get CR in its name.
rsync --timeout=60 -aP --append-verify --stats user@host:/folder /cygdrive/f/backup
echo Done `date`
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2015-08-21T15:53:33.8985969</Date>
<Author>xxx\xxx</Author>
<URI>\Backup remote</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2015-08-21T04:44:44</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByWeek>
<DaysOfWeek>
<Tuesday />
</DaysOfWeek>
<WeeksInterval>1</WeeksInterval>
</ScheduleByWeek>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>xxx</UserId>
<LogonType>Password</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>false</Enabled>
<Hidden>true</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<WakeToRun>true</WakeToRun>
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\cygwin64\bin\bash.exe</Command>
<Arguments>-l -c "/backup_remote.sh &gt;&gt; backup_remote.log 2&gt;&amp;1"</Arguments>
<WorkingDirectory>C:\cygwin64\bin</WorkingDirectory>
</Exec>
</Actions>
</Task>
@CTimmerman
Copy link
Author

--append-verify reliably resumes large files (and skips everything else). For the full command explanation, see ExplainShell.com

For text files, use -z and for non-appending updates, use -c (which is horribly slow on TBs of data as it first checksums all that before sending the file list -_-).

@CTimmerman
Copy link
Author

Here's a nice script with incremental backups of the past 29 days: http://webgnuru.com/linux/rsync_incremental.php

Alternatives are here: https://wiki.archlinux.org/index.php/Backup_programs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment