add daemon support
Merge pull request #15 from shenyan1/v5

add daemon support