From 70f03599ce71339ddda45b49b9dc7e0afb4020ea Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 4 Jul 2007 23:48:21 +0000 Subject: [PATCH] do the process separation dance on server bootstrapping, just like with the C code git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@993 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/System.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/perlmods/OpenSRF/System.pm b/src/perlmods/OpenSRF/System.pm index c0bee05..115e7c6 100644 --- a/src/perlmods/OpenSRF/System.pm +++ b/src/perlmods/OpenSRF/System.pm @@ -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"; # ----------------------------------------------- -- 2.11.0