![]() |
Back up folders over the local network
I need to back certain folders regularly from the new laptop to the old laptop.
Thanks to great help from LQ, I can do this easily like this: Quote:
But, since this is a recurring thing, I would like to automate it in bash. How can I automate this process? Make a text file with the paths to the folders to backup? Then connect with ssh? Or still use rsync?? Can I hand rsync a batch file?? |
You can still use rsync.
Use ssh keys and automate it using cron. |
I haven't used rsync in a while, but I believe this option:
--files-from=FILE read list of source-file names from FILE Can be a file of directories to rsync. Since you are running cron, the path must be full (start with /) So a file in your homedir called /home/pedro/RSYNCTHIS would be called like rsync -av --files-from=/home/pedro/RSYNCTHIS ... have in RSYNCTHIS: /home/pedro/summer2021 /home/pedro/otherthings /home/pedro/mypics etc. As any rsync command, test it is always a good thing. Rsync often does unexpected things but this is pretty straightforward. |
You can fire up rsync server (rsyncd), then there is no need to mount anything over network or create ssh connections.
|
Thank you all for the great tips!
I will try them, see if I can make it work. (Not too savvy with this stuff!) I don't really want a cron job, I think, because this is something I do at odd times, Saturday morning, Sunday afternoon. Mostly the old laptop is switched off, so I think cron wouldn't find it. |
Then automation is just writing a script that you can run as desired. Just need to use a bash script.
True, cron is really best for computers that run all the time but anacron jobs do not. |
The reason I crontab is you don't have to think about it. It is rsync, if it fails you get it the next time. And you don't have to remember to run it. Now the downside, no revisions in time. But I usually use this to get the last good version which is generally good enough.
|
rsnapshot, will save lots of space by using hard links.
|
All times are GMT -5. The time now is 12:18 PM. |