In the course of attempting to find a good, fast solution to running backups from my Linux server to my laptop for all the important stuff, I worked through the ability to run rsync on my Windows laptop using the cygwin environment, bash scripts and scheduling the backups to run in Task Scheduler. Here’s a run down of the steps I went through:
- Install Cygwin64, selecting the rsync and ssh components during the installation wizard.
- Add cygwin bin directory to environment path variables within Windows and restart (ex: C:\cygwin64\bin) so cygwin commands can be utililzed universally within the computing environment.
- Create a folder called “Backup” within the cygwin folder location (ex: C:\cygwin64\Backup).
- Perform public key creation within the Cygwin console using the ssh-keygen command. Copy the public key generated, changing the name from id_rsa.pub to authorized_keys and copy to the Linux user’s .ssh folder (ex: /home/user/.ssh) for auto-login.
- Create a bash script or scripts (ex: rsync-music.sh) containing the bash signifying line and the rsync command with ssh connection and source/destination directories:
#!/bin/bash rsync -avz --delete --stats --numeric-ids email@example.com:/Music /Backup
- Create task schedules to run the bash scripts with highest privileges using these arguments:
Program: bash.exe Arguments: -l ./rsync-music.sh Start in: C:\cygwin64\home\[username]
- If all goes well, you should have a backup within your cygwin “Backup” directory. I’ll add more to these steps as I think through them.
Leave a Reply