From ce3b20f6faceb38176508d5134bc9f12d653a0be Mon Sep 17 00:00:00 2001 From: Tom Early Date: Mon, 13 Jul 2020 10:19:07 -0700 Subject: [PATCH] remvoe and create a pid file on start-up --- config/xlxd.blacklist | 2 +- config/xlxd.interlink | 6 +++--- config/xlxd.terminal | 2 +- config/xlxd.whitelist | 2 +- rconfig | 1 - src/main.cpp | 9 +++++++++ src/main.h | 2 ++ 7 files changed, 17 insertions(+), 7 deletions(-) diff --git a/config/xlxd.blacklist b/config/xlxd.blacklist index 07d4bb5..81fd432 100644 --- a/config/xlxd.blacklist +++ b/config/xlxd.blacklist @@ -1,5 +1,5 @@ ############################################################################## -# XLXD blacklist file +# XLXD/XRFD blacklist file # # one line per entry # each entry is explicitely denied access (blacklisted) diff --git a/config/xlxd.interlink b/config/xlxd.interlink index b77ce32..454f640 100644 --- a/config/xlxd.interlink +++ b/config/xlxd.interlink @@ -1,13 +1,13 @@ ############################################################################## -# XLXD interlink file +# XLXD/XRFD interlink file # # one line per entry # each entry specifies a remote XLX or XRF to peer with # format: -# +# # for XLXD only! # # example: -# XLX270 158.64.26.132 ACD +# XLX270 158.64.26.132 ACD # for XLXD only! # XRF270 158.64.26.132 BB # # note: the remote XLX must list this XLX in its interlink file diff --git a/config/xlxd.terminal b/config/xlxd.terminal index e8b0cf5..ba08856 100644 --- a/config/xlxd.terminal +++ b/config/xlxd.terminal @@ -1,5 +1,5 @@ ######################################################################################### -# XLXD terminal option file +# XLXD/XRFD terminal option file # # one line per entry # each entry specifies a terminal option diff --git a/config/xlxd.whitelist b/config/xlxd.whitelist index fa1832e..ba5e1c6 100644 --- a/config/xlxd.whitelist +++ b/config/xlxd.whitelist @@ -1,5 +1,5 @@ ############################################################################## -# XLXD whitelist file +# XLXD/XRFD whitelist file # # one line per entry # each entry is explicitely authorised (whitelisted) diff --git a/rconfig b/rconfig index 0e1d904..c5c8ac5 100755 --- a/rconfig +++ b/rconfig @@ -72,7 +72,6 @@ WriteMemFile () { [ -z ${g3support+x} ] || echo "g3support=$g3support" >> $file [ -z ${dbsupport+x} ] || echo "dbsupport=$dbsupport" >> $file echo "===========${file}=============" - cat $file } WriteSRCHFile () { diff --git a/src/main.cpp b/src/main.cpp index 0281853..01d143a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,6 +46,10 @@ int main() std::cerr << "Malformed reflector callsign: '" << cs << "', aborting!" << std::endl; return EXIT_FAILURE; } + + // remove pidfile + remove(PIDFILE_PATH); + // splash std::cout << "Starting " << cs << " " << VERSION_MAJOR << "." << VERSION_MINOR << "." << VERSION_REVISION << std::endl << std::endl; @@ -85,6 +89,11 @@ int main() return EXIT_FAILURE; #endif + // write new pid file + std::ofstream ofs(PIDFILE_PATH, std::ofstream::out); + ofs << getpid() << std::endl; + ofs.close(); + pause(); // wait for any signal g_Reflector.Stop(); diff --git a/src/main.h b/src/main.h index f7095f1..ea96b43 100644 --- a/src/main.h +++ b/src/main.h @@ -197,6 +197,7 @@ #define INTERLINKLIST_PATH "/usr/local/etc/xrfd.interlink" #define TERMINALOPTIONS_PATH "/usr/local/etc/xrfd.terminal" #define DEBUGDUMP_PATH "/var/log/xrfd.debug" +#define PIDFILE_PATH "/var/run/xrfd.pid" #else #define XML_PATH "/var/log/xlxd.xml" #define WHITELIST_PATH "/usr/local/etc/xlxd.whitelist" @@ -204,6 +205,7 @@ #define INTERLINKLIST_PATH "/usr/local/etc/xlxd.interlink" #define TERMINALOPTIONS_PATH "/usr/local/etc/xlxd.terminal" #define DEBUGDUMP_PATH "/var/log/xlxd.debug" +#define PIDFILE_PATH "/var/run/xlxd.pid" #endif ////////////////////////////////////////////////////////////////////////////////////////