From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> Currently --daemonize expects a SIGINT to stop the daemon and build the trace.dat file. But if the user just does a: kill <pid> it will send a SIGTERM. This will actually kill the process and it will not create the trace.dat file, leaving a bunch of trace.dat.cpuX files just lying around. Update it to also do the same with SIGTERM. Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> --- tracecmd/trace-record.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 69a10bf1f0bd..c943f486291e 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -3344,6 +3344,7 @@ static void do_sig(int sig) case SIGALRM: case SIGUSR1: case SIGINT: + case SIGTERM: return finish(); case SIGUSR2: return flush(); @@ -3591,6 +3592,7 @@ static int create_recorder(struct buffer_instance *instance, int cpu, return pid; signal(SIGINT, SIG_IGN); + signal(SIGTERM, SIG_IGN); signal(SIGUSR1, do_sig); signal(SIGUSR2, do_sig); signal(SIGALRM, do_sig); @@ -7146,6 +7148,7 @@ static void record_trace(int argc, char **argv, if (type & (TRACE_TYPE_RECORD | TRACE_TYPE_STREAM)) { signal(SIGINT, do_sig); + signal(SIGTERM, do_sig); if (!latency) start_threads(type, ctx); } @@ -7182,7 +7185,7 @@ static void record_trace(int argc, char **argv, if (do_daemonize) { daemonize_finish(); - printf("Send SIGINT to pid %d to stop recording\n", getpid()); + printf("Send SIGINT/SIGTERM to pid %d to stop recording\n", getpid()); } else { /* sleep till we are woken with Ctrl^C */ printf("Hit Ctrl^C to stop recording\n"); -- 2.42.0