Silver Bay Saved My Bacon!

This morning I was attempting to customize DoorKeeper. After an hour of prodding I wanted to wipe all my changes.

1. Git checkout .
* removes changes to known files
2. Git clean -fd
* Removes unchanged files and directories

Except that’s not what I ran. I ran clean with the flags ‘fdx’ which also removes hidden files. So I lost all my .env and config files. Sure I could spend the next hour or two hunting those down.

I though Time Machine tracked these files but I didn’t see them. Silver Bay Tech has a simple blog to follow along and have Time Machine restore these files.

Mac OS X – Restoring Hidden Files and Folders with Time Machine

Thanks Silver Bay!

Quick PostgreSQL Backup

I recently learned the hard way that brew update can break a PostgreSQL install. Googling around there seem to be a variety of problems and solutions to this scenario.

I was able to get back up and running by relinking my PostgreSQL installation. That seems too easy. I now live with the nagging doubt that something worse is waiting for me in my PostgreSQL install.

To quickly setup a backup process I use the command pg_dumpall in tandem with gzip. pg_dumpall creates a SQL file to recreate my databases and gzip compresses it.

In testing, a pg_dumpall produces a 937M file. Using it with gzip downsizes it to 137M.

Here is the command below. I’ve configured this in my cron jobs to happen every evening Monday through Friday.

pg_dumpall --clean | gzip -c > dev_db.psql.gz

Restoring from backup is just as easy.

gunzip dev_db.psql.gz
psql -f dev_db.psql postgres