提交 d0534df8 编写于 作者: S Shengliang Guan

TD-1207

上级 1eace47c
...@@ -145,6 +145,8 @@ int32_t main(int32_t argc, char *argv[]) { ...@@ -145,6 +145,8 @@ int32_t main(int32_t argc, char *argv[]) {
syslog(LOG_INFO, "Shut down TDengine service successfully"); syslog(LOG_INFO, "Shut down TDengine service successfully");
dInfo("TDengine is shut down!"); dInfo("TDengine is shut down!");
closelog(); closelog();
tsem_post(&exitSem);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
...@@ -170,4 +172,5 @@ static void sigintHandler(int32_t signum) { ...@@ -170,4 +172,5 @@ static void sigintHandler(int32_t signum) {
// inform main thread to exit // inform main thread to exit
tsem_post(&exitSem); tsem_post(&exitSem);
tsem_wait(&exitSem);
} }
\ No newline at end of file
...@@ -29,7 +29,7 @@ extern "C" { ...@@ -29,7 +29,7 @@ extern "C" {
#endif #endif
#ifndef SIGHUP #ifndef SIGHUP
#define SIGHUP 1234 #define SIGHUP 1230
#endif #endif
#ifndef SIGCHLD #ifndef SIGCHLD
......
...@@ -16,18 +16,25 @@ ...@@ -16,18 +16,25 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "os.h" #include "os.h"
#include <signal.h> #include <signal.h>
#include <windows.h>
void taosSetSignal(int32_t signum, FSignalHandler sigfp) { void taosSetSignal(int32_t signum, FSignalHandler sigfp) {
if (signum == SIGUSR1) return; if (signum == SIGUSR1) return;
// 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); signal(signum, sigfp);
}
} }
void taosIgnSignal(int32_t signum) { void taosIgnSignal(int32_t signum) {
if (signum == SIGUSR1) return; if (signum == SIGUSR1 || signum == SIGHUP) return;
signal(signum, SIG_IGN); signal(signum, SIG_IGN);
} }
void taosDflSignal(int32_t signum) { void taosDflSignal(int32_t signum) {
if (signum == SIGUSR1) return; if (signum == SIGUSR1 || signum == SIGHUP) return;
signal(signum, SIG_DFL); signal(signum, SIG_DFL);
} }
...@@ -54,7 +54,7 @@ if %NODE% == 6 set NODE=7600 ...@@ -54,7 +54,7 @@ if %NODE% == 6 set NODE=7600
if %NODE% == 7 set NODE=7700 if %NODE% == 7 set NODE=7700
if %NODE% == 8 set NODE=7800 if %NODE% == 8 set NODE=7800
set "fqdn=" rem set "fqdn="
for /f "skip=1" %%A in ( for /f "skip=1" %%A in (
'wmic computersystem get caption' 'wmic computersystem get caption'
) do if not defined fqdn set "fqdn=%%A" ) do if not defined fqdn set "fqdn=%%A"
......
...@@ -37,5 +37,12 @@ if %EXEC_OPTON% == start ( ...@@ -37,5 +37,12 @@ if %EXEC_OPTON% == start (
if %EXEC_OPTON% == stop ( if %EXEC_OPTON% == stop (
rem echo wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" list INSTANCE 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
)
) )
...@@ -33,7 +33,7 @@ if exist %LOG_DIR% rmdir /s/q %LOG_DIR% ...@@ -33,7 +33,7 @@ if exist %LOG_DIR% rmdir /s/q %LOG_DIR%
if not exist %CFG_DIR% mkdir %CFG_DIR% if not exist %CFG_DIR% mkdir %CFG_DIR%
if not exist %LOG_DIR% mkdir %LOG_DIR% if not exist %LOG_DIR% mkdir %LOG_DIR%
set "fqdn=" rem set "fqdn="
for /f "skip=1" %%A in ( for /f "skip=1" %%A in (
'wmic computersystem get caption' 'wmic computersystem get caption'
) do if not defined fqdn set "fqdn=%%A" ) do if not defined fqdn set "fqdn=%%A"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册