do the process separation dance on server bootstrapping, just like with the C code
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 4 Jul 2007 23:48:21 +0000 (23:48 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 4 Jul 2007 23:48:21 +0000 (23:48 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@993 9efc2488-bf62-4759-914b-345cdb29e865

src/perlmods/OpenSRF/System.pm

index c0bee05..115e7c6 100644 (file)
@@ -10,7 +10,7 @@ use OpenSRF::Utils;
 use OpenSRF::Utils::LogServer;
 #use OpenSRF::DOM;
 use OpenSRF::EX qw/:try/;
-use POSIX ":sys_wait_h";
+use POSIX qw/setsid :sys_wait_h/;
 use OpenSRF::Utils::Config; 
 use OpenSRF::Utils::SettingsParser;
 use OpenSRF::Utils::SettingsClient;
@@ -127,7 +127,13 @@ sub bootstrap {
        my $bsconfig = OpenSRF::Utils::Config->current;
 
        # Start a process group and make me the captain
-       setpgrp( 0, 0 ); 
+       exit if (OpenSRF::Utils::safe_fork());
+       chdir('/');
+       setsid(); 
+       close STDIN;
+       close STDOUT;
+       close STDERR;
+
        $0 = "OpenSRF System";
 
        # -----------------------------------------------