This commit is contained in:
Shengliang Guan 2021-01-19 15:26:44 +08:00
parent 1eace47c85
commit d0534df8c0
6 changed files with 24 additions and 7 deletions

View File

@ -145,6 +145,8 @@ int32_t main(int32_t argc, char *argv[]) {
syslog(LOG_INFO, "Shut down TDengine service successfully");
dInfo("TDengine is shut down!");
closelog();
tsem_post(&exitSem);
return EXIT_SUCCESS;
}
@ -170,4 +172,5 @@ static void sigintHandler(int32_t signum) {
// inform main thread to exit
tsem_post(&exitSem);
tsem_wait(&exitSem);
}

View File

@ -29,7 +29,7 @@ extern "C" {
#endif
#ifndef SIGHUP
#define SIGHUP 1234
#define SIGHUP 1230
#endif
#ifndef SIGCHLD

View File

@ -16,18 +16,25 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include <signal.h>
#include <windows.h>
void taosSetSignal(int32_t signum, FSignalHandler sigfp) {
if (signum == SIGUSR1) return;
signal(signum, sigfp);
// SIGHUP doesn't exist in windows, we handle it in the way of ctrlhandler
if (signum == SIGHUP) {
SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigfp, TRUE);
} else {
signal(signum, sigfp);
}
}
void taosIgnSignal(int32_t signum) {
if (signum == SIGUSR1) return;
if (signum == SIGUSR1 || signum == SIGHUP) return;
signal(signum, SIG_IGN);
}
void taosDflSignal(int32_t signum) {
if (signum == SIGUSR1) return;
if (signum == SIGUSR1 || signum == SIGHUP) return;
signal(signum, SIG_DFL);
}

View File

@ -54,7 +54,7 @@ if %NODE% == 6 set NODE=7600
if %NODE% == 7 set NODE=7700
if %NODE% == 8 set NODE=7800
set "fqdn="
rem set "fqdn="
for /f "skip=1" %%A in (
'wmic computersystem get caption'
) do if not defined fqdn set "fqdn=%%A"

View File

@ -37,5 +37,12 @@ if %EXEC_OPTON% == start (
if %EXEC_OPTON% == stop (
rem echo wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" list INSTANCE
wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" call terminate > NUL 2>&1
rem wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" call terminate > NUL 2>&1
for /f "tokens=1 skip=1" %%A in (
'wmic process where "name='taosd.exe'" get processId '
) do (
rem echo taskkill /IM %%A
taskkill /IM %%A > NUL 2>&1
)
)

View File

@ -33,7 +33,7 @@ if exist %LOG_DIR% rmdir /s/q %LOG_DIR%
if not exist %CFG_DIR% mkdir %CFG_DIR%
if not exist %LOG_DIR% mkdir %LOG_DIR%
set "fqdn="
rem set "fqdn="
for /f "skip=1" %%A in (
'wmic computersystem get caption'
) do if not defined fqdn set "fqdn=%%A"