TD-1207
This commit is contained in:
parent
f8ee5fc413
commit
5d9ebb25b0
|
@ -120,6 +120,7 @@ int32_t main(int32_t argc, char *argv[]) {
|
||||||
taosSetSignal(SIGHUP, sigintHandler);
|
taosSetSignal(SIGHUP, sigintHandler);
|
||||||
taosSetSignal(SIGINT, sigintHandler);
|
taosSetSignal(SIGINT, sigintHandler);
|
||||||
taosSetSignal(SIGABRT, sigintHandler);
|
taosSetSignal(SIGABRT, sigintHandler);
|
||||||
|
taosSetSignal(SIGBREAK, sigintHandler);
|
||||||
|
|
||||||
// Open /var/log/syslog file to record information.
|
// Open /var/log/syslog file to record information.
|
||||||
openlog("TDengine:", LOG_PID | LOG_CONS | LOG_NDELAY, LOG_LOCAL1);
|
openlog("TDengine:", LOG_PID | LOG_CONS | LOG_NDELAY, LOG_LOCAL1);
|
||||||
|
@ -152,12 +153,6 @@ static void siguser1Handler(int32_t signum) { taosCfgDynamicOptions("debugFlag 1
|
||||||
static void siguser2Handler(int32_t signum) { taosCfgDynamicOptions("resetlog"); }
|
static void siguser2Handler(int32_t signum) { taosCfgDynamicOptions("resetlog"); }
|
||||||
|
|
||||||
static void sigintHandler(int32_t signum) {
|
static void sigintHandler(int32_t signum) {
|
||||||
// clean the system.
|
|
||||||
dInfo("shut down signal is %d", signum);
|
|
||||||
|
|
||||||
syslog(LOG_INFO, "Shut down signal is %d", signum);
|
|
||||||
syslog(LOG_INFO, "Shutting down TDengine service...");
|
|
||||||
|
|
||||||
// protect the application from receive another signal
|
// protect the application from receive another signal
|
||||||
taosIgnSignal(SIGUSR1);
|
taosIgnSignal(SIGUSR1);
|
||||||
taosIgnSignal(SIGUSR2);
|
taosIgnSignal(SIGUSR2);
|
||||||
|
@ -165,6 +160,13 @@ static void sigintHandler(int32_t signum) {
|
||||||
taosIgnSignal(SIGHUP);
|
taosIgnSignal(SIGHUP);
|
||||||
taosIgnSignal(SIGINT);
|
taosIgnSignal(SIGINT);
|
||||||
taosIgnSignal(SIGABRT);
|
taosIgnSignal(SIGABRT);
|
||||||
|
taosIgnSignal(SIGBREAK);
|
||||||
|
|
||||||
|
// clean the system.
|
||||||
|
dInfo("shut down signal is %d", signum);
|
||||||
|
|
||||||
|
syslog(LOG_INFO, "Shut down signal is %d", signum);
|
||||||
|
syslog(LOG_INFO, "Shutting down TDengine service...");
|
||||||
|
|
||||||
// inform main thread to exit
|
// inform main thread to exit
|
||||||
tsem_post(&exitSem);
|
tsem_post(&exitSem);
|
||||||
|
|
|
@ -44,6 +44,10 @@ extern "C" {
|
||||||
#define SIGUSR2 1234
|
#define SIGUSR2 1234
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SIGBREAK
|
||||||
|
#define SIGBREAK 1234
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void (*FSignalHandler)(int32_t signum);
|
typedef void (*FSignalHandler)(int32_t signum);
|
||||||
void taosSetSignal(int32_t signum, FSignalHandler sigfp);
|
void taosSetSignal(int32_t signum, FSignalHandler sigfp);
|
||||||
void taosIgnSignal(int32_t signum);
|
void taosIgnSignal(int32_t signum);
|
||||||
|
|
Loading…
Reference in New Issue