Merge pull request #309 from jssjr/add-hup-signal-handler

Add hup signal handler (refactors #198)
Merge pull request #311 from jssjr/backport-pr309

Backport #309 from jssjr/add-hup-signal-handler to 0.9.x