Jump to content

Backup Preferences — Create and restore Alfred Preferences backups


Recommended Posts

Usage


Generate a backup of your local Alfred Preferences via the start backup keyword. A macOS launchd agent will be loaded to do it daily at the time set in the Workflow’s Configuration (using the 24-hour clock format). The number of versions to keep is likewise configurable.


start.png


Restore a previous version with the restore backup keyword. It takes a few seconds to complete and restarts Alfred.


restore.png


⤓ Install on the Alfred Gallery | Source

Link to comment

When reporting issues, please include your exact installed versions of:

  • The Workflow.
  • Alfred.
  • macOS.

In addition to:

  • The debugger output. Perform the failing action, click “Copy” on the top right and paste it here.
  • Details on what you did, what happened, and what you expected to happen. A short video of the steps with the debugger open may help to find the problem faster.

Thank you. Accurate and thorough information is crucial for a proper diagnosis which allows me to help you better.

Link to comment
  • 4 weeks later...
  • 6 months later...

Can an interval be added for the number of days? I prefer to back up weekly or every x  number of days and nights every day since my preference file is 400MB each on both my Macs, and I am backing up to iCloud. 

Edited by mikedvzo
wording
Link to comment

That would add a bit of complexity and I worry might lead to foot guns. macOS launchd agents don’t run if your computer is turned off, so I’d hate for someone to not have a backup at a crucial time because the last one happened to be at an unlucky time and then the one they have is two weeks old or more. That’s why a time can be configured. The versioning is a secondary concern, the focus of the workflow is the backup.


You could instead reduce the number of backed up versions. If by any reason you need an older version at some point, the last 30 days of them should be available to recover.

Link to comment
  • 1 month later...

New to me that you can restart Alfred while a workflow is running… I wonder if /usr/bin/osascript -l JavaScript -e 'Application("com.runningwithcrayons.Alfred").quit()' and /usr/bin/osascript -l JavaScript -e 'Application("com.runningwithcrayons.Alfred").activate()' is recommend if you want to restart Alfred if something weird is going on and you know restarting will probably fix it. 

Link to comment

I recommend against that. When something weird is going on, you want to reset things in the simplest, most manual way possible. You do not want to risk a strange restart not clearing whatever you’re seeing. Though I never in a decade had to restart Alfred due to something weird.

Link to comment
9 hours ago, vitor said:

When something weird is going on, you want to reset things in the simplest, most manual way possible

Got it. 

 

9 hours ago, vitor said:

Though I never in a decade had to restart Alfred due to something weird.

Happened several times to me this year when files or apps won't show in Alfred's default result, but a restart fixed it.

Link to comment
  • 4 weeks later...

How do you change the number of backups after the script is installed? I see the default value in the script, but I'm not sure where it is reading the value that I entered during install.

 

 

Link to comment
On 4/18/2024 at 12:22 PM, vitor said:

That would add a bit of complexity and I worry might lead to foot guns. macOS launchd agents don’t run if your computer is turned off, so I’d hate for someone to not have a backup at a crucial time because the last one happened to be at an unlucky time and then the one they have is two weeks old or more. That’s why a time can be configured. The versioning is a secondary concern, the focus of the workflow is the backup.


You could instead reduce the number of backed up versions. If by any reason you need an older version at some point, the last 30 days of them should be available to recover.

I thought about this more and I am trying to modify your workflow to add the Weekday argument to the LaunchAgent PLIST. From a backup perspective running a backup daily and keeping 8 copies is more unreliable than running it weekly and keeping 8 copies. If the file is corrupt you overwrite the old backups and be left with 8 corrupted versions. 

Link to comment
16 hours ago, mikedvzo said:

How do you change the number of backups

 

Change it in the Workflow’s Configuration. It’ll take the next time a backup fires.

 

16 hours ago, mikedvzo said:

I am trying to modify your workflow to add the Weekday argument to the LaunchAgent PLIST.

 

I recommend launchd.info for learning more.

 

16 hours ago, mikedvzo said:

From a backup perspective running a backup daily and keeping 8 copies is more unreliable than running it weekly and keeping 8 copies.

 

A weekly backup may not catch the changes you need if you need the backup in an emergency (e.g. disk failure).

 

16 hours ago, mikedvzo said:

If the file is corrupt you overwrite the old backups and be left with 8 corrupted versions. 

 

Alfred Preferences is a folder (a bundle) not a single file. And backups are never overwritten, they are trashed, so you can recover them from there or iCloud, as pointed out above.

Link to comment
  • 2 months later...

Can this workflow be updated to work with a non-default preferences location?  It looks like the workflow checks for the actual preferences location, but stops if it doesn't match the default path.

 

Is there a reason why a custom preferences location cannot be gzipped and saved like default location is?

Link to comment

If you use a custom location, you can set it to a path that syncs and does its own management of versioning. And that could interfere with the backup by e.g. ejecting files and making them unavailable offline. The workflow very deliberately only works with the default location because that’s the only way it can guarantee a correct backup.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...