Now properly handles a KILL process while running in Daemon mode
This commit is contained in:
parent
96d35e9af6
commit
5abdeb283d
|
@ -429,12 +429,28 @@ Begin
|
|||
End;
|
||||
End;
|
||||
|
||||
Procedure DaemonEventSignal (Sig : LongInt); cdecl;
|
||||
Begin
|
||||
Case Sig of
|
||||
SIGTERM : Begin
|
||||
TelnetServer.Free;
|
||||
SMTPServer.Free;
|
||||
POP3Server.Free;
|
||||
FTPServer.Free;
|
||||
NNTPServer.Free;
|
||||
NodeData.Free;
|
||||
Halt(0);
|
||||
End;
|
||||
|
||||
End;
|
||||
End;
|
||||
|
||||
Procedure ExecuteDaemon;
|
||||
Var
|
||||
PID : TPID;
|
||||
SID : TPID;
|
||||
Begin
|
||||
WriteLn('- Executing Mystic Internet Server in daemon mode');
|
||||
WriteLn('- [MIS] Executing Mystic Internet Server in daemon mode');
|
||||
|
||||
PID := fpFork;
|
||||
|
||||
|
@ -454,6 +470,8 @@ Begin
|
|||
Halt(1);
|
||||
End;
|
||||
|
||||
fpSignal (SIGTERM, DaemonEventSignal);
|
||||
|
||||
Repeat
|
||||
WaitMS(60000); // Heartbeat
|
||||
Until False;
|
||||
|
|
Loading…
Reference in New Issue