Auto-restart the agent

- Only will restart if the `--autorestart` flag is given as a command-line option (off by default).
- There are some tests that make sure exiting and restarting works as expected.
- A `SIGUSR1` will trigger an auto-restart.