my $pid = fork(); if($pid != 0){ exit 0; } chdir "/"; close STDOUT; close STDERR; close STDIN; POSIX::setsid(); # this takes care of controlling terminals