Add code to attach the target.
Add a mode: sleep mainly for the test of cockroach-loader.