in reply to forking from web

You are correct that you need to run a daemon, but I don't think there should be any problem with daemonizing in the CGI before you exec(). For example,

#!/usr/bin/perl -w use CGI qw( header ); use strict; use POSIX qw( setsid ); my $pid; # fork die "cannot fork: $!" unless defined ( $pid = fork() ); # if parent if ( $pid ) { # reply to user print header(), "Process forked."; } else { # we're the child # so we don't prevent filesystems from being unmounted chdir '/' or die "Can't chdir to /: $!"; # redirect IO, or we'll be sucky and make the CGI hang open STDIN, '/dev/null' or die "Can't read /dev/null: $!"; open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!"; # thank you, POSIX ( I'd have hated to call ioctl() myself! ;-) setsid or die "Can't start a new session: $!"; # lets wait until after setsid to redirect STDERR open STDERR, '>&STDOUT' or die "Can't dup stdout: $!"; # run our background process exec("/path/process"); }
--4c6966653a205468652073656172636820666f
  7220746861742070657266656374204765656b
  20436869632c20746865206f6e652077697468
  2074686520737061726b6c696e672065796573
  2077686f20706c617973206973207261696e2e