Skip to content
Browse files

adding a handy shell script to backup all Keyboard Maestro data and s…

…ettings
  • Loading branch information...
1 parent f25328d commit 260b8c2887dc4f3f9d4c0892f0b4714065559243 Kaushik Gopal committed Mar 2, 2012
Showing with 46 additions and 4 deletions.
  1. +35 −0 0.Backup_KM.sh
  2. +11 −4 README.md
View
35 0.Backup_KM.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Shell Script to Backup your Keyboard Maestro Data and Settings
+# Author: Kaushik Gopal
+# --------------------------------------------------------------
+
+# Working command
+# ditto -c -k --sequesterRsrc --keepParent ~/Library/'Application Support/Keyboard Maestro'/ ~/Dropbox/'Application Support/Keyboard Maestro'/`date "+KM5_backup_%Y-%m-%d_%H%M%S"`.zip
+
+## Set the Backup path ##
+bkp="Dropbox/Application Support/Keyboard Maestro"
+
+## Set KM Source path ##
+src="Library/Application Support/Keyboard Maestro"
+
+## Preferred Date Suffix ##
+filename=$(date +"KM5_backup_%Y-%m-%d_%H%M%S.zip")
+
+# Creat a zipped bkup with dated suffix
+ditto -c -k --sequesterRsrc --keepParent ~/"$src"/ ~/"$bkp"/"$filename"
+
+## Growl the File name is successfully created ##
+if [ -f ~/"$bkp"/"$filename" ]
+ then
+ echo "KM Backup successfully complete. Backed up at ~/$bkp/$filename";
+ else
+ echo "Me no find Backup FAIL!";
+fi
+
+## Remove backups older than your last three backups ##
+ls -t ~/"$bkp"/KM5_backup_* | awk 'NR>3 {system("rm \"" $0 "\"")}'
+
+# The ls command lists files with the latest 2 on top
+# The awk command states that for those lines (NR = number of records, i.e. lines) greater than 2, delete them
+# The quote characters are needed just in case the file names have embedded spaces
+# http://stackoverflow.com/questions/1426434/remove-old-backup-files
View
15 README.md
@@ -10,12 +10,19 @@ some of the scripts are application specific, so i suggest you create a new grou
# AVAILABLE SCRIPTS
-1. Open two new Finders and align : (apply to Finder)
-Open two new Finder windows and have them aligned neatly
+0. Backup complete Keyboard Maestro Shell script
+
+ This is a shell script to backup all your Keyboard Maestro Settings and Data
+
+1. Open two new Finders and align : (apply to Finder)
+
+ Open two new Finder windows and have them aligned neatly
2. Delete Permanently : (apply to Finder)
-When you delete a file from Finder, it generally goes to the Trash. However unlike Windows, there's no direct shortcut key to "Delete Permanently" from the Finder (without having to go to the Trash bin and then manually delete from there as well)
+
+ When you delete a file from Finder, it generally goes to the Trash. However unlike Windows, there's no direct shortcut key to "Delete Permanently" from the Finder (without having to go to the Trash bin and then manually delete from there as well)
3. Keyword Search Engine : (apply to Browser)
-This is pretty awesome. I've always whined that Google Chrome doesn't sync "[Keyword Search engines](http://www.google.com/support/chrome/bin/answer.py?answer=95653)" and so having to set this up each time I wipe my settings is a pain. Moreover, if shift to Safari, this had to be setup again. With this script, I get some sane uniformity for my browsing search experience. KM's awesome developer Peter Lewis whipped this one personally for me. He's one of the awesomest most responsive developers.
+
+ This is pretty awesome. I've always whined that Google Chrome doesn't sync "[Keyword Search engines](http://www.google.com/support/chrome/bin/answer.py?answer=95653)" and so having to set this up each time I wipe my settings is a pain. Moreover, if shift to Safari, this had to be setup again. With this script, I get some sane uniformity for my browsing search experience. KM's awesome developer Peter Lewis whipped this one personally for me. He's one of the awesomest most responsive developers.

0 comments on commit 260b8c2

Please sign in to comment.
Something went wrong with that request. Please try again.