I agree, your example is correct, that's how fork works.
My demo above is what i'm doing. If I run that from the command line, it executes twice, yes. But if apache executes it, some_cmd is only executed once. I expect it has something to do with my
close STDOUT line, which in a normal script apparently is a synonym for
exit() (when run by apache). So, really, I don't understand why it ran some_cmd
once, when it should have been either none or twice, I could rationally explain either of those outcomes
It's not what you look like, when you're doin' what you’re doin'.
It's what you’re doin' when you’re doin' what you look like you’re doin'!
- Charles Wright & the Watts 103rd Street Rhythm Band, Express yourself