allow the cwd to be passed in via opt.cwd
move __daemon env flag to self daemonization function

No need to set this flag in the "other script" daemonization.