Best method to backup notes

Hi,

I'm very new to all this, slowly but surely moving away from "proprietary" solutions, so hope you won't loose your patience with my questions :wink:

If I "read" your script properly

BACKUP_DIR="/path/to/backup_dir" --> you specify the backup directory

JOPLIN_BIN="$HOME/.npm-global/bin/joplin" --> you are saying where the Joplin.bin file is

$JOPLIN_BIN sync --> are you here synchronizing the version on your desktop? Which means you have a sync version somewhere else, and you make sure you sync everything before backing up, right?

$JOPLIN_BIN e2ee decrypt --> is this needed all the time? Let's say I don't use encryption for my notes, but maybe Joplin.bin is encrypted? I will most likely use encryption, but just checking my understanding. So this means you are backing up a non crypted version of the app, correct?

cd "$BACKUP_DIR" --> you (the script) goes into the backup directory

rm -f *.md --> delete all pre-existing md file

rm -f resources/* --> delete all pre-existing file in the resources folder --> I saw that resources folder in the pack content (I'm on Mac), but are those resources backed up when you only back up the Joplin.bin file?

$JOPLIN_BIN --log-level debug export --format raw "$BACKUP_DIR" --> log-level debug I guess is a type of log, a txt file to show you if everything went well, and if not what could it be, correct? Then you export in RAW format, into the backup directory, correct? Why not in JEX? Is it because your backup is only for the app (since you are the developper)? So I guess I could change that to JEX for my own script right?

git add . --> I read it is adding the file to the indexation, correct?

git commit -m "Update" --> I read it changes the head, what is it? Where? Does it change the name of the file?


Reason why I tried to understand is I'd like to create a script to back up my notes, ie, basically have a script which makes :

  • a JEX export to a specific location (I believe I can use part of your script to do that)

  • on a regular basis --> from your script it seems to be a script you run manually?

  • And ideally, I'd like to keep x versions, so have a check on how many version there is in the back up directory, if I have "maxed out" the number of version, delete the most ancient one, and add the new one. So if I want to keep 5 versions, and there are already 5, delete the oldest one, and create the new one.

I would appreciate if:

  1. You can confirm I understood the script properly
  2. If you (anyone reading this thread in fact) can support me with terminal code achieving what I would like to do :slight_smile:

Thanks,

Virginie