#start of cgi #blah blah blah if(fork()) { exit 0; } else { close STDOUT; close STDIN; close STDERR; # do rest of work here }