Code

Don't use POE ATM
[gosa.git] / gosa-si / gosa-si-bus
index 330d205a94cab6caa121329a979eec9896b7e960..a5d50f1d2429bbd1db64e2b82ba3daeb49cdb56c 100755 (executable)
@@ -1262,8 +1262,20 @@ if(-e $log_file ) { unlink $log_file }
 daemon_log(" ", 1);
 daemon_log("$0 started!", 1);
 
+# forward error messages to logfile
+if( ! $foreground ) {
+       open(STDERR, '>>', $log_file);
+       open(STDOUT, '>>', $log_file);
+}
+
 # Just fork, if we"re not in foreground mode
-if( ! $foreground ) { $pid = fork(); }
+if( ! $foreground ) {
+       chdir '/'                 or die "Can't chdir to /: $!";
+       $pid = fork;
+       setsid                    or die "Can't start a new session: $!";
+       umask 0;
+}
+
 else { $pid = $$; }
 
 # Do something useful - put our PID into the pid_file