Bug 133 - cleanup data<pid> directory on SIGINT
This commit is contained in:
@ -115,6 +115,16 @@ static void sigterm_handler (int i) {
|
|||||||
shutdown_gateway();
|
shutdown_gateway();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sigint_handler (int i)
|
||||||
|
{
|
||||||
|
extern void shutdown_gateway();
|
||||||
|
|
||||||
|
skygw_log_write( LOGFILE_ERROR, "Signal SIGINT %i received ...Exiting!\n", i);
|
||||||
|
shutdown_gateway();
|
||||||
|
fprintf(stderr, "Shuting down MaxScale\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* wrapper for sigaction */
|
/* wrapper for sigaction */
|
||||||
static void signal_set (int sig, void (*handler)(int)) {
|
static void signal_set (int sig, void (*handler)(int)) {
|
||||||
static struct sigaction sigact;
|
static struct sigaction sigact;
|
||||||
@ -291,12 +301,14 @@ fail_accept_errno = 0;
|
|||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
signal_set(SIGHUP, sighup_handler);
|
|
||||||
signal_set(SIGTERM, sigterm_handler);
|
|
||||||
|
|
||||||
gw_daemonize();
|
gw_daemonize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal_set(SIGHUP, sighup_handler);
|
||||||
|
signal_set(SIGTERM, sigterm_handler);
|
||||||
|
signal_set(SIGINT, sigint_handler);
|
||||||
|
|
||||||
|
|
||||||
l = atexit(libmysqld_done);
|
l = atexit(libmysqld_done);
|
||||||
|
|
||||||
if (l != 0) {
|
if (l != 0) {
|
||||||
@ -468,6 +480,8 @@ fail_accept_errno = 0;
|
|||||||
"MaxScale shutdown, PID %i\n",
|
"MaxScale shutdown, PID %i\n",
|
||||||
getpid());
|
getpid());
|
||||||
|
|
||||||
|
datadir_cleanup();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} // End of main
|
} // End of main
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user