A Script to Backup Evernote to Dropbox

In the previous post I made on this topic, I talked about how to use Git to backup your Evernotes into Dropbox.

In this post, I wanted to share the script that I created to automate doing those backups:


# Evernote directory. Season to taste.
DIR="$HOME/Library/Containers/com.evernote.Evernote/Data/Library/Application Support/Evernote/accounts/Evernote"

# Errors are fatal
set -e 

# Check to see if Evernote is running
PIDS=`ps ax |grep -i evernote |grep -v grep |grep -v backup-evernote` || true
#echo $PIDS # Debugging

if test "$PIDS"
        echo "Evernote is still running!  Please exit Evernote before trying to back up."
        exit 1

cd "$DIR"
git add .
git status
COMMENT="Backup on `date`"
git commit -m "$COMMENT" . || true
git push -u origin master

A few notes about the previous script:

  • Checking to see if Evernote is running first is just a good idea. Trying to back up files which are being actively used is asking for trouble.
  • Wherever you see || true that means "if the previous command exited with non-zero, run the 'true' command". This has the effect of ignoring errors from specific commands.
  • The assumption is made that you set up your origin, as outlined in the previous post.

This script (and other related utilities) are available for download in my GitHub repo at https://github.com/dmuth/unix-utils. Enjoy!

Average: 5 (2 votes)
Your rating: None