Index: obs_notify_generic/obs_notify_generic.pm
===================================================================
--- obs_notify_generic/obs_notify_generic.pm	(revision 1184)
+++ obs_notify_generic/obs_notify_generic.pm	(revision 1188)
@@ -34,7 +34,10 @@
 use Data::Dumper;
 use IPC::Run;
+use Proc::Daemon;
 use Time::Piece;
 
 #use XML::Simple;
+
+# stdout goes to /srv/obs/log/src_server.log
 
 sub new
@@ -57,5 +60,5 @@
 
     $type = "UNKNOWN" unless $type;
-
+    
     my $cfg_type;
     if ( $self->{'cfg'}->{$type} ) {
@@ -72,5 +75,10 @@
             #print "key: $key\n";
             #print "value: $value\n";
-            if ( not( $paramRef->{$key} =~ /$value/ ) ) {
+            if ( not( exists($paramRef->{$key}) ) ) {
+				error_msg( "$type (". Data::Dumper->new( [$paramRef] )->Indent(0)->Dump ."): filter for '". $key ."' is invalid" );
+                $match = 0;
+                # exit loop
+                last;
+            } elsif ( not( $paramRef->{$key} =~ /$value/ ) ) {
                 $match = 0;
             }
@@ -86,38 +94,19 @@
 					$paramRef->{'project_path'}="/srv/obs/repos/" . $project;
                 }
-                my $check = join '|', keys %{$paramRef};
+                # create regex, 
+                # test against longest string first to avoid partial replacement ($repo, $repository)
+                my $check = join '|', sort { 
+                        length($b) <=> length($a)
+                    } keys %{$paramRef};
                 my $action = $entry->{'action'};
                 $action =~ s/\$($check)/$paramRef->{$1}/g;
 
-                #print $action, "\n";
-                my $in = undef;
-                my $out;
-                my $err;
-                my $rc;
-                eval {
-                    my $process =
-                      IPC::Run::start( [ "sh", "--login", "-c", "HOME=/usr/lib/obs $action", "2>&1" ],
-                        \$in, \$out, \$err );
-                    $process->finish();
-                    $rc = $process->result(0);
-                };
-                if ($@) {
-
-                    #print "eval: ", $@;
-                    $out = join( "\n", $@ );
-                    $rc = 127;
-                }
-
-                #print "rc:  ", $rc, "\n";
-                #print "out: ", $out, "\n";
-                chomp($out);
-
-                #print "err: ", $err, "\n";
-                $extra = {
-                        'action_template' => $entry->{'action'},
-                        'action'          => $action,
-                        'returncode'      => $rc,
-                        'output'          => $out,
-                    };
+				$extra = {
+					'action_template' => $entry->{'action'},
+					'action'          => $action,
+				};
+                
+                #$self->run_wait( $action, $extra );
+                $self->run_daemon( $action, $extra );
             }
             if ( $entry->{'log'} ) {
@@ -129,5 +118,52 @@
         }
     }
-
+}
+
+sub run_wait
+{
+    my ( $self, $action, $extra ) = @_;
+
+	#print $action, "\n";
+	my $in = undef;
+	my $out;
+	my $err;
+	my $rc;
+	eval {
+		my $process =
+			IPC::Run::start( [ "sh", "--login", "-c", "HOME=/usr/lib/obs $action", "2>&1" ],
+			\$in, \$out, \$err );
+		$process->finish();
+		$rc = $process->result(0);
+	};
+	if ($@) {
+
+		#print "eval: ", $@;
+		$out = join( "\n", $@ );
+		$rc = 127;
+	}
+
+	#print "rc:  ", $rc, "\n";
+	#print "out: ", $out, "\n";
+	chomp($out);
+
+	#print "err: ", $err, "\n";
+	$extra->{'returncode'} = $rc;
+	$extra->{'output'} = $out;
+}
+
+sub run_daemon
+{
+    my ( $self, $action, $extra ) = @_;
+
+    my $daemon=Proc::Daemon->new();
+    my $pid=$daemon->Init( {
+            exec_command => "date --rfc-3339=seconds; echo '$action'; $action", 
+            child_STDOUT => "+>>" . $self->{'logfile'} . ".out.log", 
+            child_STDERR => "+>>" . $self->{'logfile'} . ".out.log",
+        } );
+
+    #print $daemon->Status($pid);  
+        
+    $extra->{'pid'} = $pid;
 }
 
