var
  STAct: sigactionrec;
  
  Procedure SigtermCallback (sig: cint); cdecl;
  begin
    ExitRequested:=Yes;
    ReceivedSigterm:=Yes;
  end;
  
  procedure SetSigtermHandler;
  begin
    FillChar(STAct, SizeOf(STAct), 0);
    STAct.sa_handler:=@SigtermCallback;
    if FpSigAction(SIGTERM, @STAct, nil) <> 0
      then Die(
        'Не удалось установить обработчик SIGTERM',
        'Unable to set action handler for SIGTERM',[]);
  end;
  

