I decided lately to (again) give a try to Evernote. And so far I like it, I found it smoother to use than my previous solution. I’m not sure I’ll continue to use it forever though, but so far I find it interesting.
My concern is of course data safety. It is synced to Evernote’s servers, not backed up, and the risk is that if it is screwed in one place it will then be replicated to other devices, unless disconnected from the Internet.
So how to make a backup of the data?
I googled and found the blog of Jamie Rubin, who used AppleScript and automated it using Lingon. But I’m new to Apple, and I have no clue of those tools.
So I went the usual Linux way, tarball and crontab!
So we first need to find where the data is located. For this, go to the Evernote menu, choose “About Evernote” and when the information box is opened, press the Alt-key. This will display a link “Open database folder”. Click on it and Finder will open into the directory.
It is necessary to do so, because the database directory is located differently, depending if you downloaded Evernote from the Appstore or directly from www.evernote.com.
I just wrote a small bash script called evernote-bkp.sh which is now located in my bin-directory:
#database directory we want to backup
# change directory so we don't keep the complete path in the tarball
# note the double quotes for making it working even if there's a space in your path
# file name with a timestamp so we never erase a precious backup
tar -zcf $dest $database
Don’t forget to make it executable: open a terminal window and write:
$ chmod +x evernote-bkp.sh
The next step is make this script run regularly, by using crontab. The problem is that Apple has deprecated crontab! There’s a new tool called launchd instead. I won’t explain how to use it (please read here for instance).
Here is the the plist-file I wrote. It is located in ~/Library/LauncherAgents/ and is called se.korbinus.evernote-bkp:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
It’s now necessary to tell launchd to load the plist-file. In a terminal window, go to ~/Library/LauncherAgents/ and write the command:
$ launchctl load se.korbinus.evernote-bkp