aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs36
-rw-r--r--prebuild.xml1
2 files changed, 37 insertions, 0 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index f60b5fb..d151de6 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -61,6 +61,9 @@ namespace OpenSim.Server.Base
61 // 61 //
62 private bool m_Running = true; 62 private bool m_Running = true;
63 63
64 private static Mono.Unix.UnixSignal[] signals;
65
66
64 // Handle all the automagical stuff 67 // Handle all the automagical stuff
65 // 68 //
66 public ServicesServerBase(string prompt, string[] args) : base() 69 public ServicesServerBase(string prompt, string[] args) : base()
@@ -183,6 +186,39 @@ namespace OpenSim.Server.Base
183 RegisterCommonCommands(); 186 RegisterCommonCommands();
184 RegisterCommonComponents(Config); 187 RegisterCommonComponents(Config);
185 188
189 Thread signal_thread = new Thread (delegate ()
190 {
191 while (true)
192 {
193 // Wait for a signal to be delivered
194 int index = Mono.Unix.UnixSignal.WaitAny (signals, -1);
195
196 //Mono.Unix.Native.Signum signal = signals [index].Signum;
197 ShutdownSpecific();
198 m_Running = false;
199 Environment.Exit(0);
200 }
201 });
202
203 if(!Util.IsWindows())
204 {
205 try
206 {
207 // linux mac os specifics
208 signals = new Mono.Unix.UnixSignal[]
209 {
210 new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM)
211 };
212 signal_thread.Start();
213 }
214 catch (Exception e)
215 {
216 m_log.Info("Could not set up UNIX signal handlers. SIGTERM will not");
217 m_log.InfoFormat("shut down gracefully: {0}", e.Message);
218 m_log.Debug("Exception was: ", e);
219 }
220 }
221
186 // Allow derived classes to perform initialization that 222 // Allow derived classes to perform initialization that
187 // needs to be done after the console has opened 223 // needs to be done after the console has opened
188 Initialise(); 224 Initialise();
diff --git a/prebuild.xml b/prebuild.xml
index cb39e18..fddbca3 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -497,6 +497,7 @@
497 <Reference name="OpenSim.Framework.Monitoring"/> 497 <Reference name="OpenSim.Framework.Monitoring"/>
498 <Reference name="OpenSim.Framework.Servers"/> 498 <Reference name="OpenSim.Framework.Servers"/>
499 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 499 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
500 <Reference name="Mono.Posix" path="../../../bin/"/>
500 <Reference name="Nini" path="../../../bin/"/> 501 <Reference name="Nini" path="../../../bin/"/>
501 <Reference name="log4net" path="../../../bin/"/> 502 <Reference name="log4net" path="../../../bin/"/>
502 503