in reply to fork and stdout/stderr

exec "cmd1 >/tmp/cmdone.log 2>&1"; #combine stdout/stdin exec "cmd2 >/tmp/cmdtwo.out 2>/tmp/cmdtwo.err";# split them up
Then read back in your log files. Fork or whatever along the way.