Improve signal handling, add restarting

Is triggered by a SIGHUP. Also, handle SIGTERM correctly (when killing a
process instead of Ctrl-C-ing it).