You read my mind! Thanks for posting this.
Nice, I was looking for this. Only it does not stops postgres properly.
Hi,This scripts doesn't work properly and it might even be dangerous to your db(it's doing hard shutdown every time)this one seems to works much betterhttps://gist.github.com/haad/6020401
only the exec statement is commented out.