diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog
index 7020116d54..2413bcd601 100644
--- a/pandora_agents/ChangeLog
+++ b/pandora_agents/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-08  Sancho Lerena <slerena@artica.es>
+
+	* unix/pandora_agent_daemon: Kill with -9 to be sure is killed,
+	because UDP server mode "captures" the INT signal to restart
+	the agent when receibe REFRESH AGENT on UDP client.
+
+	* unix/Linux/pandora_agent.conf: New config tokens to support UDP
+	server options.
+
+	* unix/pandora_agent: UDP Server mode implemented in the Unix/Perl
+	agent, only for REFRESH AGENT option, no remote commands possible.
+
 2010-10-06  Junichi Satoh  <junichi@rworks.jp>
 
 	* unix/pandora_agent: Added FreeBSD specific commands.
diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf
index a4327fcdcb..0d48912adc 100755
--- a/pandora_agents/unix/Linux/pandora_agent.conf
+++ b/pandora_agents/unix/Linux/pandora_agent.conf
@@ -19,14 +19,23 @@ interval    	300
 # and does not copy XML to server.
 debug 		0	
 
+# Optional. UDP Server to receive orders from outside
+# By default is disabled, set 1 to enable
+# Set port (41122 by default) 
+# Set address to restrict who can order a agent restart (0.0.0.0 = anybody)
+#
+udp_server 0
+udp_server_port 41122
+udp_server_auth_address 0.0.0.0
+
 # By default, agent takes machine name
 #agent_name     adama
 
 #Parent agent_name
-#parent_agent_name parent_name
+#parent_agent_name caprica
 
 # Agent description
-#description Demo agent
+#description This is a demo agent for Linux
 
 # Group assigned for this agent (descriptive, p.e: Servers)
 #group Servers
@@ -34,7 +43,7 @@ debug 		0
 # Autotime: Enforce to server to ignore timestamp coming from this
 # agent, used when agents has no timer or it's inestable. 1 to enable
 # this feature
-# autotime 1
+#autotime 1
 
 # Timezone offset: Difference with the server timezone
 #timezone_offset 0
@@ -53,7 +62,7 @@ debug 		0
 #position_description Madrid, centro
 
 # By default agent try to take default encoding defined in host.
-# encoding 	iso-8859-15
+#encoding 	iso-8859-15
 
 # Listening TCP port for remote server. By default is 41121 (for tentacle)
 # if you want to use SSH use 22, and FTP uses 21.
@@ -63,30 +72,30 @@ server_port	41121
 transfer_mode tentacle
 
 # Server password (Tentacle or FTP). Leave empty for no password (default).
-# server_pwd mypassword
+#server_pwd mypassword
 
 # Set to yes/no to enable/disable OpenSSL support for Tentacle (disabled by default).
-# server_ssl no
+#server_ssl no
 
 # Extra options for the Tentacle client (for example, server_opts "-v -r 5").
-# server_opts
+#server_opts
 
 # delayed_startup defines number of MINUTES before start execution
 # for first time when startup Pandora FMS Agent
-# delayed_startup 10
+#delayed_startup 10
 
 # Pandora nice defines priority of execution. Less priority means more intensive execution
 # A recommended value is 10. 0 priority means no Pandora CPU protection enabled (default)
-# pandora_nice 0
+#pandora_nice 0
 
 # Cron mode replace Pandora FMS own task schedule each XX interval seconds by the use
 # of old style cron. You should add to crontab Pandora FMS agent script to use this mode.
 # This is disabled by default, and is not recommended.  Use Pandora FMS internal scheduler
-# is much more safe.
-# cron_mode 
+# is much more safe
+#cron_mode 
 
 # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) 
-# remote_config 1
+#remote_config 1
 
 # Number of threads to execute modules in parallel
 #agent_threads 1
@@ -97,14 +106,14 @@ transfer_mode tentacle
 # If secondary_mode is set to on_error, data files are copied to the secondary
 # server only if the primary server fails. If set to always, data files are
 # always copied to the secondary server.
-# secondary_mode on_error
-# secondary_server_ip localhost
-# secondary_server_path /var/spool/pandora/data_in
-# secondary_server_port 41121
-# secondary_transfer_mode tentacle
-# secondary_server_pwd mypassword
-# secondary_server_ssl no
-# secondary_server_opts
+#secondary_mode on_error
+#secondary_server_ip localhost
+#secondary_server_path /var/spool/pandora/data_in
+#secondary_server_port 41121
+#secondary_transfer_mode tentacle
+#secondary_server_pwd mypassword
+#secondary_server_ssl no
+#secondary_server_opts
 
 # Module Definition
 # =================
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 80ce69ec5a..a281d3b9ae 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -28,6 +28,7 @@ use POSIX qw(strftime floor);
 use Sys::Hostname;
 use File::Basename;
 use File::Copy;
+use IO::Socket;
 
 # Agent XML data
 my $Xml;
@@ -47,6 +48,7 @@ eval {
 	require threads;
 	require threads::shared;
 	require Thread::Semaphore;
+    require IO::Socket;
 };
 if (!$@) {
 	threads::shared::share (\$Xml);
@@ -54,8 +56,8 @@ if (!$@) {
 	$Sem = Thread::Semaphore->new;
 }	
 
-use constant AGENT_VERSION => '3.1';
-use constant AGENT_BUILD => '100608';
+use constant AGENT_VERSION => '3.2dev';
+use constant AGENT_BUILD => '101008';
 
 # Commands to retrieve total memory information in kB
 use constant TOTALMEMORY_CMDS => {
@@ -146,7 +148,10 @@ my %Conf = (
 	'autotime' => 0,
 	'timezone_offset' => 0,
 	'pandora_exec' => 'pandora_exec',
-	'agent_threads' => 1
+	'agent_threads' => 1,
+    'udp_server_port' => 41122,
+    'udp_server_auth_address' => '0.0.0.0',
+    'udp_server' => 0
 );
 
 # Modules
@@ -1203,6 +1208,43 @@ sub write_module_xml ($@) {
  	$Sem->up () if (defined ($Sem));
 }
 
+################################################################################
+# Receive a UDP server signal to restart agent
+################################################################################
+sub udp_server_signal () {
+    log_message ('udp server', 'Received signal to restart the agent.');
+}
+
+################################################################################
+# Basic UDP server to restart agent on UDP signal received
+################################################################################
+sub udp_server ($$) {
+
+    my $udp_port = shift;
+    my $udp_auth_address = shift;
+    my $parent_pid = getppid();
+
+    my($sock, $oldmsg, $newmsg, $hisaddr, $hishost, $MAXLEN);
+    $MAXLEN = 1024;
+
+    log_message ('udp server', 'Starting UDP server listening on '.$udp_auth_address.":".$udp_port);
+    $sock = IO::Socket::INET->new(LocalPort => $udp_port, Proto => 'udp') or die "socket: $@";
+
+    while ($sock->recv($newmsg, $MAXLEN)) {
+	    my($port, $ipaddr) = sockaddr_in($sock->peername);
+	    $hishost = gethostbyaddr($ipaddr, AF_INET);
+
+        log_message ('udp server', 'Received signal from '.$hishost);
+
+        if (($udp_auth_address eq "0.0.0.0") || ($hishost eq $udp_auth_address)){
+            if ($newmsg =~ /REFRESH AGENT/){
+                # Send signal to restart agent
+                kill 'SIGINT' , $parent_pid;
+            }
+        }
+    } 
+}
+
 ################################################################################
 # Execute the given plugin.
 ################################################################################
@@ -1260,9 +1302,25 @@ my $PID = $$;
 # Add the plugins directory to the PATH
 $ENV{'PATH'} .= ":$ConfDir/plugins";
 
+# Start UDP server if configured
+if ($Conf{'udp_server'} == 1){
+    my $pid = fork();
+
+    if ($pid == 0){
+        udp_server ($Conf{'udp_server_port'}, $Conf{'udp_server_auth_address'});
+        exit;
+    }
+}
+
+
 # Loop
 while (1) {
 
+    # Ignore signals from UDP server while processing execution
+    if ($Conf{'udp_server'} == 1){
+        $SIG{'INT'} = 'DEFAULT';
+    }
+
 	# Check for a new configuration
 	check_remote_config () unless ($Conf{'debug'} eq '1');
 
@@ -1353,6 +1411,11 @@ while (1) {
 	# Cron mode
 	last if ($Conf{'cron_mode'} == 1);
 	
+    # Enable signal capture to break the Sleep interval on UDP signal
+    if ($Conf{'udp_server'} == 1){
+        $SIG{'INT'} = \&udp_server_signal;
+    }
+
 	# Go to sleep
 	sleep ($Conf{'interval'});
 }
diff --git a/pandora_agents/unix/pandora_agent_daemon b/pandora_agents/unix/pandora_agent_daemon
index 205473e338..e5abc91fff 100755
--- a/pandora_agents/unix/pandora_agent_daemon
+++ b/pandora_agents/unix/pandora_agent_daemon
@@ -93,7 +93,7 @@ case "$1" in
 			exit 1
 		else
 			echo "Stopping Pandora Agent."
-			kill $PANDORA_PID > /dev/null 2>&1        
+			kill -9 $PANDORA_PID > /dev/null 2>&1        
 		fi
 	;;