Let’s say you want to backup some files on a server, but not clone the whole thing. Here’s a way to do it that’s nice and easy to maintain over time.
Create a folder. This will be the directory we back up.
Symlink everything you want to backup into that folder.
For example, to backup your nginx config, you could do
ln -s /etc/nginx /to-backup.
rsyncin a cron job or similar to regularly copy that folder to another machine. Use the
-Lflag so the symlinks are followed.
That’s it! Now you can add something to your backup jobs just by symlinking it into your backup directory.
Of course, it’s probably still worth doing a full clone of the server periodically to speed up recovery after a big failure, but this is nice for key files and config.