Changeset 10465 in ntrip for trunk/BNC/src/bncmain.cpp


Ignore:
Timestamp:
May 2, 2024, 9:41:10 AM (4 months ago)
Author:
stuerze
Message:

a SIGHUP signal to BNC will result into a reload of its configuration file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncmain.cpp

    r10451 r10465  
    6464
    6565void catch_SIGINT(int) {
    66   cout << "Program Interrupted by Ctrl-C" << endl;
     66  cout << "BNC Interrupted by Ctrl-C" << endl;
    6767  BNC_CORE->sigintReceived = 1;
    6868  BNC_CORE->stopPPP();
     
    7676}
    7777
    78 void catch_SIGPIPE(int signum) {
    79   cout << "Caught signal SIGPIPE " << signum << endl;
     78void catch_SIGTERM(int) {
     79  cout << "BNC Terminated" << endl;
     80  BNC_CORE->sigintReceived = 1;
     81  BNC_CORE->stopPPP();
     82  BNC_CORE->stopCombination();
     83#ifndef WIN32
     84  sleep(2);
     85#else
     86  Sleep(2000);
     87#endif
     88  ::exit(0);
     89}
     90
     91void catch_SIGHUP(int) {
     92  cout << "BNC received SIGHUP signal: reload configuration" << endl;
     93  bncSettings settings;
     94  settings.reRead();
     95  BNC_CORE->caster()->readMountPoints();
    8096}
    8197
     
    449465  }
    450466
    451 
    452 
    453 #ifndef WIN32
    454   signal(SIGPIPE, catch_SIGPIPE);
    455 #endif
    456 
    457     // Interactive Mode - open the main window
     467  // Interactive Mode - open the main window
    458468  // -----------------------------------------
    459469  if (interactive) {
     
    512522
    513523    signal(SIGINT, catch_SIGINT);
     524    signal(SIGTERM, catch_SIGTERM);
     525    signal(SIGHUP, catch_SIGHUP);
    514526
    515527    BNC_CORE->sigintReceived = 0;
     
    552564      caster->addGetThread(getThread, true);
    553565    }
     566
    554567  }
    555568
Note: See TracChangeset for help on using the changeset viewer.