Implement proper shutdown procedure for postgres (#284)
Implement proper shutdown procedure for postgres (#284)

This commit adds a proper SIGINT/SIGTERM/SIGQUIT handling which
sends a SIGTERM to the postgres process if it's running and enters
'smart shutdown mode', then waits for postgres to terminate.

xref: https://www.postgresql.org/docs/9.3/server-shutdown.html
This works on all supported versions.

Fixes kubedb/project#554
xref: kubedb/project#556
k8sdb/postgres,k8sdb/postgres,k8sdb/postgres