-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backup multiple collections #1
Comments
Glad it can help! No I haven't addressed backing up multiple collections. This script isn't strictly a generic backup script per se -- it is a wrapper intended to protect a single collection at a time by replacing using the SM exe or shortcut directly. Basically you configure the script to point to a single collection, then run the script instead and it will disable Dropbox, back up that one collection, launch it in SM, then when SM is closed it will restart Dropbox. If you want to protect multiple collections you should make a separate copy of the script & config file for each. Ideally I would have modified the script to accept the config file as a parameter, but the current solution is the simplest thing that could possibly work for solving this particular problem. (well maybe it could be simpler, but this is simple enough) There is some interesting development happening on the SM Discord server. One of the members is working on a major enhancement to SM through an external utility/driver written in C# (to replace some of our AutoHotKey customizations) and has already built an alpha version of a generic backup utility that will run block-level shadow copies of any folder you specify, so it shouldn't be affected by Dropbox/etc at all. But it is 0.1 alpha so given the criticality of SM collections to each of us I'm personally using this script for the foreseeable future. Once the other is more mature I may switch. His app is called BitShelter and is available in this repo: https://github.com/alexis-/BitShelter |
Thank you for your answer and suggestion. |
Glad to help. If you want you can come to the Discord and I'm sure he would help you troubleshoot it in realtime. He's great about supporting the community. I think this invite still works, it's the one posted on the SuperMemoPedia wiki: https://discord.gg/pB7jcSK We have several hardcore members there from around the world who have been using SM for many years, including one who has become good friends with Piotr Wozniak himself. In the 2 months or so since it launched we've had thousands of messages flying, and compiled a set of best practices summarized in the SuperMemoLore doc (92 pages last I checked) hosted on the SuperMemo repo (unofficial repo created by Alexis) found here: https://github.com/supermemo/SupermemoLore |
Not sure if it helps anyone in particular, but I was looking for a quick way to create backups before launching SuperMemo and inspired by this repo's script I came up with a very short PowerShell script that gets the job done, backing up all the collections in my C:\SuperMemo\systems folder. It also stops running after launching SuperMemo, so I don't have an extra running process icon in my taskbar. As before, customize the first three variables to suit. It uses robocopy to add retries to the file copy process but I've skipped the validation process which ideally would use hashes of the file contents to confirm files were copied as desired, it's just not that important to me if I've multiple copies of my backups already, though if there's an easy to use free tool for doing so, I'd consider swapping to it. $collectionRootDir = "C:\SuperMemo\systems\"
$collectionName = "Louis Collection"
$backupRootDir = "C:\Users\louis\OneDrive\Documents\SuperMemo Backups\"
$backupName = (Get-Date).ToString("yyyyMMddTHHmmss") + " - " + $collectionName
$toDir = $backupRootDir + $backupName
robocopy $collectionRootDir $toDir /E /R:5 /W:5 /MT:8
$knoFilePath = $collectionRootDir + $collectionName + ".Kno"
Start-Process $knoFilePath -WorkingDirectory $collectionRootDir -PassThru I don't feel the need to sync my collection over the internet yet, so I've dropped the sync killing feature. If I did need it, I'd probably try to sync a backup instead of the live SuperMemo directory. What I mean by this is I'd copy a backup to the cloud, then on the other computers, look for a more recent backup and copy it down before starting the app. This way the app is always running outside of the cloud sync sandbox, and the cloud sync is only used to upload backups after the app runs, and download backups before the app launches. Theoretically, you could use the cloud to store app launch state -- like a lock file -- that way you could warn if the app was opened on multiple computers. If you saved the computer name to the lock file, you could tell yourself which computer had the app open, so you could go to it, presumably wake it from sleep, and close it. Or live with the data loss inherent from having a "split-brain" problem. Ideally there'd be a way to merge two collections by merging the actions done in both, as if replaying from a series of timestamps. But I haven't looked into things enough to know if there's such a replay log for state-modifying actions like that. |
Thank your sharing this script!
I was looking for a good solution to keep my collections safe. Have you planned to integrate an option to backup multiple collections that sit in the same folder?
The text was updated successfully, but these errors were encountered: