# first part of script # some code if(fork){ output("I'm doing some work, please wait."); exit; } close(STDIN); close(STDERR); # do the rest of the work here