Code

finished jobs are set to 'done' and deleted from job queue
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 14:31:51 +0000 (14:31 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 14:31:51 +0000 (14:31 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9323 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server
gosa-si/modules/GosaPackages.pm
gosa-si/modules/GosaSupportDaemon.pm
gosa-si/server/events/databases.pm
gosa-si/server/events/gosaTriggered.pm
gosa-si/tests/client.php

index f3b7f143651a16882f276756d61a617d2fef9ae7..86678654b3ee31e18ce2040859bc5f357c3ae732 100755 (executable)
@@ -795,6 +795,7 @@ sub get_local_ip_for_remote_ip {
        return $result;
 }
 
+
 sub send_msg_to_target {
     my ($msg, $address, $encrypt_key, $msg_header) = @_ ;
     my $error = 0;
@@ -805,8 +806,7 @@ sub send_msg_to_target {
   
     if( $msg_header ) {
         $header = "'$msg_header'-";
-    }
-    else {
+    } else {
         $header = "";
     }
 
@@ -853,14 +853,12 @@ sub send_msg_to_target {
             $sql_statement = "DELETE FROM known_clients WHERE hostname='$address'";
             $res = $known_clients_db->del_dbentry($sql_statement);
             daemon_log("WARNING: failed 2x to send msg to host '$address', delete host from known_clients", 3);
-        } 
-        else { 
+        } else { 
             $sql_statement = "UPDATE known_clients SET status='$new_status' WHERE hostname='$address'";
             $res = $known_clients_db->update_dbentry($sql_statement);
             if($new_status eq "down"){
                 daemon_log("WARNING: set '$address' from status '$act_status' to '$new_status'", 3);
-            }
-            else {
+            } else {
                 daemon_log("INFO: set '$address' from status '$act_status' to '$new_status'", 5);
             }
         }
@@ -891,6 +889,27 @@ sub send_msg_to_target {
 }
 
 
+sub update_jobdb_status_for_send_msgs {
+    my ($answer, $error) = @_;
+    if( $answer =~ /<jobdb_id>(\d+)<\/jobdb_id>/ ) {
+        my $jobdb_id = $1;
+        if( $error ) {
+            # sending msg faild
+            my $sql_statement = "UPDATE $job_queue_tn ".
+                "SET status='error', result='can not deliver msg, please consult log file' ".
+                "WHERE id='$jobdb_id'";
+            my $res = $job_db->update_dbentry($sql_statement);
+        } else {
+            # sending msg was successful
+            my $sql_statement = "UPDATE $job_queue_tn ".
+                "SET status='done' ".
+                "WHERE id='$jobdb_id'";
+            my $res = $job_db->update_dbentry($sql_statement);
+        }
+    }
+}
+
+
 sub _start {
     my ($kernel) = $_[KERNEL];
     &trigger_db_loop($kernel);
@@ -901,7 +920,7 @@ sub _start {
 
 sub client_input {
     no strict "refs";
-    my ($kernel, $session, $heap,$input,$wheel) = @_[KERNEL, SESSION, HEAP, ARG0, ARG1];
+    my ($kernel, $session, $heap, $input, $wheel) = @_[KERNEL, SESSION, HEAP, ARG0, ARG1];
     my $session_id = $session->ID;
     my ($msg, $msg_hash, $module);
     my $error = 0;
@@ -970,7 +989,8 @@ sub client_input {
                     while( my ($hit_num, $hit) = each %{ $query_res } ) {    
                         my $host_name = $hit->{hostname};
                         my $host_key = $hit->{hostkey};
-                        &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
+                        my $error = &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
+                        &update_jobdb_status_for_send_msgs($answer, $error);
                     }
                 }
 
@@ -983,7 +1003,8 @@ sub client_input {
                         my $host_name = $hit->{hostname};
                         my $host_key = $hit->{hostkey};
                         $answer =~ s/KNOWN_SERVER/$host_name/g;
-                        &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
+                        my $error = &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
+                        &update_jobdb_status_for_send_msgs($answer, $error);
                     }
                 }
 
@@ -1005,12 +1026,13 @@ sub client_input {
                     $answer =~ /<header>(\S+)<\/header>/;   
                     my $header;
                     if( defined $1 ) { $header = $1; }
-                    &send_msg_to_target($answer, $server_address, $GosaPackages_key, $header);
+                    my $error = &send_msg_to_target($answer, $server_address, $GosaPackages_key, $header);
+                    &update_jobdb_status_for_send_msgs($answer, $error);
                 }
 
                 # target of msg is a mac address
                 elsif( $answer_target =~ /^([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})$/i ) {
-                    daemon_log("target is mac address '$answer_target', looking for host in known_clients", 3);
+                    daemon_log("INFO: target is mac address '$answer_target', looking for host in known_clients", 5);
                     my $sql_statement = "SELECT * FROM known_clients WHERE macaddress='$answer_target'";
                     my $query_res = $known_clients_db->select_dbentry( $sql_statement );
                     my $found_ip_flag = 0;
@@ -1018,8 +1040,9 @@ sub client_input {
                         my $host_name = $hit->{hostname};
                         my $host_key = $hit->{hostkey};
                         $answer =~ s/$answer_target/$host_name/g;
-                        daemon_log("found host '$host_name', associated to '$answer_target'", 3);
-                        &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
+                        daemon_log("INFO: found host '$host_name', associated to '$answer_target'", 5);
+                        my $error = &send_msg_to_target($answer, $host_name, $host_key, $answer_header);
+                        &update_jobdb_status_for_send_msgs($answer, $error);
                         $found_ip_flag++ ;
                     }   
                     if( $found_ip_flag == 0) {
@@ -1031,7 +1054,8 @@ sub client_input {
                             while( my ($hit_num, $hit) = each %{ $query_res } ) {    
                                 my $bus_address = $hit->{hostname};
                                 my $bus_key = $hit->{hostkey};
-                                &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
+                                my $error = &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
+                                &update_jobdb_status_for_send_msgs($answer, $error);
                                 last;
                             }
                         }
@@ -1051,19 +1075,21 @@ sub client_input {
                             my $query_res = $known_server_db->select_dbentry( $sql_statement );
                             my $res_length = keys( %{$query_res} );
                             if( $res_length == 0 ){
-                                daemon_log("WARNING: send '$answer_header' to '$bus_address' failed, no bus found in known_server", 3);
+                                daemon_log("WARNING: send '$answer_header' to '$bus_address' failed, ".
+                                        "no bus found in known_server", 3);
                             }
                             else {
                                 while( my ($hit_num, $hit) = each %{ $query_res } ) {    
                                     my $bus_key = $hit->{hostkey};
-                                    &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
+                                    my $error = &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
+                                    &update_jobdb_status_for_send_msgs($answer, $error);
                                 }
                             }
                         }
                         next;
                     }
-                    # send_msg
-                    &send_msg_to_target($answer, $answer_target, $encrypt_key, $answer_header);
+                    my $error = &send_msg_to_target($answer, $answer_target, $encrypt_key, $answer_header);
+                    &update_jobdb_status_for_send_msgs($answer, $error);
                 }
             }
         }
@@ -1074,7 +1100,9 @@ sub client_input {
             my $session_id = $1;
             if( defined $session_id ) {
                 my $session_reference = $kernel->ID_id_to_session($session_id);
-                $heap = $session_reference->get_heap();
+                if( defined $session_reference ) {
+                    $heap = $session_reference->get_heap();
+                }
             }     
         }
         $heap->{client}->put($client_answer);
@@ -1143,6 +1171,10 @@ sub watch_for_new_jobs {
         $job_msg =~ s/<\/xml>$/<jobdb_id>$jobdb_id<\/jobdb_id><\/xml>/;
 
                my $func_error = &send_msg_to_target($job_msg, $server_address, $GosaPackages_key, $header);
+
+        # update status in job queue to 'processing'
+        $sql_statement = "UPDATE $job_queue_tn SET status='processing' WHERE id='$jobdb_id'";
+        my $res = $job_db->update_dbentry($sql_statement);
     }
 
        $kernel->delay_set('watch_for_new_jobs', $job_queue_loop_delay);
index 9f1f256969cc5fd7d1ec3c216ecb6246f0b835e2..6f6a5e0b775381a4726a69ba92ee35404d1379d1 100644 (file)
@@ -314,12 +314,9 @@ sub process_gosa_msg {
         no strict 'refs';
         @out_msg_l = &{$event_hash->{$header}."::$header"}($msg, $msg_hash, $session_id);
     }
-print STDERR "===============================\n"; 
-print STDERR Dumper(@out_msg_l);
-
 
     # if delivery not possible raise error and return 
-    if( not defined @out_msg_l[0] ) {
+    if( not defined $out_msg_l[0] ) {
         &main::daemon_log("WARNING: GosaPackages got no answer from event handler '$header'", 3);
         @out_msg_l = ();
     } elsif( $out_msg_l[0] eq 'nohandler') {
@@ -349,6 +346,8 @@ sub process_job_msg {
     my $macaddress;
     if( exists $msg_hash->{'macaddress'} ) {
         $macaddress = @{$msg_hash->{'macaddress'}}[0];
+    } elsif (@{$msg_hash->{'target'}}[0] =~ /^([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})$/i ) {
+        $macaddress = $1;
     } else {
         $error ++;
         $out_msg = "<xml>".
@@ -356,7 +355,7 @@ sub process_job_msg {
             "<source>$server_address</source>".
             "<target>GOSA</target>".
             "<answer1>1</answer1>".
-            "<error_string>no mac address specified</error_string>".
+            "<error_string>no mac address specified, neither in target-tag nor in macaddres-tag</error_string>".
             "</xml>";
     }
     
index 3e6551f12f9317b9ce483a0e1a6b46f3e514d7b0..e33c83eaa5305d9ad72c3a07931ebb2d36fb77db 100644 (file)
@@ -248,7 +248,7 @@ sub get_where_statement {
                 if( exists $phrase->{'operator'} ) {
                     my $op = $op_hash->{$phrase->{'operator'}[0]};
                     if( not defined $op ) {
-                        &main::daemon_log("Can not translate operator '$operator' in where ".
+                        &main::daemon_log("ERROR: Can not translate operator '$operator' in where ".
                                 "statement to sql valid syntax. Please use 'eq', ".
                                 "'ne', 'ge', 'gt', 'le', 'lt' in xml message\n", 1);
                         &main::daemon_log($msg, 8);
index 054d5eab0e22883f77f1eeef6fcbce0ee64b32c6..a8916fdb952a2770bb86ffc66cdbebb9cec28b9c 100644 (file)
@@ -158,7 +158,8 @@ sub update_status_jobdb_entry {
 
         # conditions
         # no timestamp update if status eq waiting
-        my $res_hash = $main::job_db->select_dbentry("SELECT * FROM $table $where AND status='processing' ");
+        my $sql_statement = "SELECT * FROM $table $where AND status='processing'";
+        my $res_hash = $main::job_db->select_dbentry($sql_statement);
         if( (0 != keys(%$res_hash)) && ($update =~ /timestamp/i) ) {
             $error ++;
             $out_xml = "<answer1>1</answer1><error_string>there is no timestamp update allowed while status is 'processing'</error_string>";
@@ -171,7 +172,6 @@ sub update_status_jobdb_entry {
 
             # check success of db update
             if( not $db_res > 0 ) { $error++; };
-
         }
     }
 
index 2e54deb5bc2d487db71d544d214c56093ad33fac..d16dd1bbba9e17ff8461ee9dc1ebf96e1ba076f8 100644 (file)
@@ -26,6 +26,7 @@ my @events = (
     "trigger_action_rescan",
     "trigger_action_wake",
     "recreate_fai_server_db",
+    "send_user_msg", 
     );
 @EXPORT = @events;
 
@@ -51,15 +52,99 @@ sub get_events {
     return \@events;
 }
 
+sub send_user_msg {
+    my ($msg, $msg_hash, $session_id) = @_ ;
+    my @out_msg_l;
+    my @user_list;
+    my @group_list;
+
+    my $header = @{$msg_hash->{'header'}}[0];
+    my $source = @{$msg_hash->{'source'}}[0];
+    my $target = @{$msg_hash->{'target'}}[0];
+    my $message = @{$msg_hash->{'message'}}[0];
+    if( exists $msg_hash->{'user'} ) { @user_list = @{$msg_hash->{'user'}}; }
+    if( exists $msg_hash->{'group'} ) { @group_list = @{$msg_hash->{'group'}}; }
+
+    # error handling
+    if( not @user_list && not @group_list ) {
+        &main::daemon_log("WARNING: no user-tag or a group-tag specified in 'send_user_msg'", 3); 
+        return ("<xml><header>$header</header><source>GOSA</source><target>GOSA</target>".
+                "<error_string>no user-tag or a group-tag specified in 'send_user_msg'</error_string></xml>");
+    }
+    if( not defined $message ) {
+        &main::daemon_log("WARNING: no message-tag specified in 'send_user_msg'", 3); 
+        return ("<xml><header>$header</header><source>GOSA</source><target>GOSA</target>".
+                "<error_string>no message-tag specified in 'send_user_msg'</error_string></xml>");
+
+    }
+
+    # resolve groups to users
+    if( @group_list ) {
+        # build ldap connection
+        &main::refresh_ldap_handle();
+        if( not defined $main::ldap_handle ) {
+            &main::daemon_log("ERROR: cannot connect to ldap", 1);
+            return ();
+        } 
+        foreach my $group (@group_list) {
+            # Perform search
+            my $mesg = $main::ldap_handle->search( 
+                    base => $main::ldap_base,
+                    scope => 'sub',
+                    attrs => ['memberUid'],
+                    filter => "(&(objectClass=posixGroup)(cn=$group)(memberUid=*))");
+            if($mesg->code) {
+                &main::daemon_log($mesg->error, 1);
+                return ();
+            }
+            my $entry= $mesg->entry(0);
+            my @users= $entry->get_value("memberUid");
+            foreach my $user (@users) { push(@user_list, $user); }
+        }
+    }
+
+    # drop multiple users in @user_list
+    my %seen = ();
+    foreach my $user (@user_list) {
+        $seen{$user}++;
+    }
+    @user_list = keys %seen;
+
+    # build xml messages sended to client where user is logged in
+    foreach my $user (@user_list) {
+        my $sql_statement = "SELECT * FROM $main::login_users_tn WHERE user='$user'"; 
+        my $db_res = $main::login_users_db->select_dbentry($sql_statement);
+
+        if(0 == keys(%{$db_res})) {
+
+        } else {
+            while( my($hit, $content) = each %{$db_res} ) {
+                my $out_hash = &create_xml_hash('send_user_msg', $main::server_address, $content->{'client'});
+                &add_content2xml_hash($out_hash, 'message', $message);
+                &add_content2xml_hash($out_hash, 'user', $user);
+                if( exists $msg_hash->{'jobdb_id'} ) { 
+                    &add_content2xml_hash($out_hash, 'jobdb_id', @{$msg_hash->{'jobdb_id'}}[0]); 
+                }
+                my $out_msg = &create_xml_string($out_hash);
+                push(@out_msg_l, $out_msg);
+            }
+        }
+    }
+
+    return @out_msg_l;
+}
+
 
 sub recreate_fai_server_db {
     my ($msg, $msg_hash, $session_id) = @_ ;
+    my $out_msg;
+
     $main::fai_server_db->create_table("new_fai_server", \@main::fai_server_col_names);
     &main::create_fai_server_db("new_fai_server");
     $main::fai_server_db->move_table("new_fai_server", $main::fai_server_tn);
 
-    return;
+    my @out_msg_l = ( $out_msg );
+    return @out_msg_l;
 }
 
 
@@ -105,17 +190,14 @@ sub get_client_for_login_usr {
 
 
 sub ping {
-     my ($msg, $msg_hash, $session_id) = @_ ;
-     my $source = @{$msg_hash->{source}}[0];
-     my $target = @{$msg_hash->{target}}[0];
-     my $out_hash =  &create_xml_hash("ping", $source, $target);
-     &add_content2xml_hash($out_hash, "session_id", $session_id);
-     my $out_msg = &create_xml_string($out_hash);
-    
-     my @out_msg_l = ( $out_msg );
-     return @out_msg_l;
-}
+    my ($msg, $msg_hash, $session_id) = @_ ;
+    my $out_msg = $msg;
+    $out_msg =~ s/<header>gosa_/<header>/;
+    $out_msg =~ s/<\/xml>/<session_id>$session_id<\/session_id><\/xml>/; 
 
+    my @out_msg_l = ( $out_msg );
+    return @out_msg_l;
+}
 
 sub gen_smb_hash {
      my ($msg, $msg_hash, $session_id) = @_ ;
@@ -163,6 +245,9 @@ sub detect_hardware {
     my $target = @{$msg_hash->{target}}[0];
 
     my $out_hash = &create_xml_hash("detect_hardware", $source, $target);
+    if( exists $msg_hash->{'jobdb_id'} ) { 
+        &add_content2xml_hash($out_hash, 'jobdb_id', @{$msg_hash->{'jobdb_id'}}[0]); 
+    }
     my $out_msg = &create_xml_string($out_hash);
 
     my @out_msg_l = ( $out_msg );
@@ -176,6 +261,9 @@ sub trigger_reload_ldap_config {
     my $target = @{$msg_hash->{target}}[0];
 
     my $out_hash = &create_xml_hash("reload_ldap_config", $main::server_address, $main::server_address, $target);
+    if( exists $msg_hash->{'jobdb_id'} ) { 
+        &add_content2xml_hash($out_hash, 'jobdb_id', @{$msg_hash->{'jobdb_id'}}[0]); 
+    }
     my $out_msg = &create_xml_string($out_hash);
     my @out_msg_l;
     push(@out_msg_l, $out_msg);
@@ -191,8 +279,10 @@ sub set_activated_for_installation {
     my $target = @{$msg_hash->{target}}[0];
 
     my $out_hash = &create_xml_hash("set_activated_for_installation", $source, $target);
+    if( exists $msg_hash->{'jobdb_id'} ) { 
+        &add_content2xml_hash($out_hash, 'jobdb_id', @{$msg_hash->{'jobdb_id'}}[0]); 
+    }
     my $out_msg = &create_xml_string($out_hash);
-
     my @out_msg_l = ( $out_msg );
     return @out_msg_l;
 }
@@ -288,7 +378,9 @@ sub trigger_action_rescan {
 
 sub trigger_action_wake {
     my ($msg, $msg_hash) = @_;
-    my %data = ( 'macAddress'  => \@{$msg_hash->{macAddress}} );
+    my %data = ( 'macAddress'  => \@{$msg_hash->{'macAddress'}} ,
+            'jobdb_id' => \@{$msg_hash->{'jobdb_id'}},
+            );
     my $out_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data);
     my @out_msg_l = ($out_msg);  
     return @out_msg_l;
index 244686b6055f6e39244d8b11164c2af5e0c5bd40..1d53e1ad60444776217dff9d84e4449c70d4e1c3 100755 (executable)
@@ -18,10 +18,11 @@ if($sock->connected()){
 # jobdb add
 #$data = "<xml> <header>gosa_network_completition</header> <source>GOSA</source><target>GOSA</target><hostname>ws-muc-2</hostname></xml>";
 #$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
-#$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source> <target>10.89.1.155:20081</target><macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>20130102133900</timestamp> </xml>";
+#$data = "<xml> <header>job_ping</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <macaddress>00:01:6c:9d:b9:fa</macaddress><timestamp>19700101000000</timestamp> </xml>";
+
 
 # jobdb delete
-#$data = "<xml> <header>gosa_delete_jobdb_entry</header><where><clause><phrase><id>3</id></phrase></clause></where></xml>";
+#$data = "<xml> <header>gosa_delete_jobdb_entry</header> <source>GOSA</source> <target>GOSA</target> <where><clause><phrase><id>1</id></phrase></clause></where></xml>";
 
 # smbhash
 #$data = "<xml> <header>gosa_gen_smb_hash</header> <source>GOSA</source><target>GOSA</target><password>tester</password></xml>";
@@ -30,8 +31,8 @@ if($sock->connected()){
 #$data = "<xml> <header>gosa_trigger_reload_ldap_config</header> <source>GOSA</source><target>00:01:6c:9d:b9:fa</target></xml>";
 
 # jobdb update  
-#$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <macaddress>00:01:6c:9d:b9:fa</macaddress></phrase></clause> </where> <update><timestamp>23450101000000</timestamp><result>XXXXXXXXXXXXXXx</result></update></xml>";
-#$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <status>waiting</status></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
+#$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source> <target>GOSA</target> <where><clause><phrase> <id>1</id></phrase></clause></where> <update><timestamp>19700101000000</timestamp></update></xml>";
+#$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <macaddress>00:01:6c:9d:b9:fa</macaddress></phrase></clause> </where> <update><status>done</status> <result>update</result></update></xml>";
 
 # jobdb query
 #$data = "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target>".
@@ -44,23 +45,23 @@ if($sock->connected()){
 #$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target></xml>";
 
 # jobdb count
-#$data = "<xml> <header>gosa_count_packages_list</header><source>GOSA</source> <target>GOSA</target></xml>";
+#$data = "<xml> <header>gosa_count_jobdb</header><source>GOSA</source> <target>GOSA</target></xml>";
 
 # jobdb clear
-#$data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
+#$data = "<xml> <header>gosa_clear_jobdb</header> <source>GOSA</source> <target>GOSA</target></xml>";
 
 # set gosa-si-client to 'activated'
-#$data = "<xml> <header>gosa_set_activated_for_installation</header> <target>10.89.1.31:20083</target> <source>127.0.0.1:20081</source> </xml>";
+#$data = "<xml> <header>job_set_activated_for_installation</header> <target>10.89.1.31:20083</target> <source>GOSA</source> <macaddress>00:01:6c:9d:b9:fa</macaddress></xml>";
+
 
 
 # trigger jobs at client
 #$data = "<xml> <header>gosa_detect_hardware</header> <target>10.89.1.31:20083</target> <source>10.89.1.31:20081</source> </xml>";
 #$data = "<xml> <header>gosa_new_key_for_client</header> <target>00:01:6c:9d:b9:fa</target> <source>10.89.1.31:20081</source> </xml>";
-#$data = "<xml> <header>gosa_trigger_action_wake</header> <target>00:01:6c:9d:b9:fa</target> <source>10.89.1.31:20081</source> </xml>";
+#$data = "<xml> <header>job_trigger_action_wake</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> <timestamp>19700101000000</timestamp></xml>";
 #$data = "<xml> <header>gosa_trigger_action_faireboot</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
-#$data = "<xml> <header>job_trigger_action_reinstall</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> ".
-#    "<macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>20130101000000</timestamp> </xml>";
-$data = "<xml> <header>gosa_ping</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
+#$data = "<xml> <header>job_trigger_action_reinstall</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>20130101000000</timestamp> </xml>";
+#$data = "<xml> <header>gosa_ping</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
 
 
 # to test
@@ -87,6 +88,12 @@ $data = "<xml> <header>gosa_ping</header> <target>00:01:6c:9d:b9:fa</target> <so
 # recreate_fai_server_db
 #$data = "<xml> <header>gosa_recreate_fai_server_db</header> <target>GOSA</target> <source>GOSA</source></xml>"; 
 
+# testing
+#$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <user>susi</user> <user>harald</user> <user>susi</user> <group>gosa-admins-all</group> </xml>"; 
+#$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <group>gosa-admins-all</group> <usrmesg>kaffeepause</usrmesg> </xml>"; 
+$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <user>cajus.pollmeier</user> <message>kaffeepause</message> </xml>"; 
+
+
     $sock->write($data);
     $answer = "nothing";
        $answer = $sock->read();