A backup script for both Linux and macOS

I love Logseq, and use Syncthng to sync my note graph between my devices (an Ubuntu desktop, a Fedora laptop and a Macbook Pro). One day I got several sync conflicts between my desktop and laptop (it was my fault), and after spending too much time trying to resolve them, I decided I needed a way to take snapshot of my graph I can keep as a reference or as a quick restore point in case of disaster.

I used Joplin in the past, and liked the workflow of the Backup plugin, so I wrote this script, trying to replicate that workflow.

You can get it from here:

Comments, tests and pr are welcome!


Wouldn’t a general backup tool achieve the same result? Why create a specific script?

It’s true, a generic backup tool could achieve the same result, but there are a few important differences:

  1. Being dedicated archives, they are smaller, quicker to create (it takes me less than 3s) and easier to manage than a full backup of my home, that requires several minutes to complete - and my graph might change while a full backup of my home is running!
  2. Since these archives are so quick to create, I can get a coherent backup right after my login, before I start any work, and before I break anything, and I can take several other backups during the day (if there’s any change).
  3. Since these are small packages, I can keep them locally for quick restore if needed, without the need to pull them from the NAS or the external disks I use for full backups.
  4. Since they are so small and encrypted, I can also safely put them on free cloud storage such as Google Drive, OneDrive, iCloud for remote backup.

What to I mean for “small” and “quick”:

  • My current Logseq graph directory is ~8 MB
  • My last backup archive is ~5MB
  • Time to create that archive is < 3s

I understand that all of this might seem overkill in some cases, but it’s useful for me :wink:

1 Like