Skip to content

Commit

Permalink
mxqd: Dump server state on SIGUSR2 q=10
Browse files Browse the repository at this point in the history
A dump of server state can be triggerd by

  env kill -usr2 -q 10 mxqd
  • Loading branch information
donald committed Jul 5, 2017
1 parent e64d665 commit 8660ae5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,9 +1364,6 @@ void server_dump(struct mxq_server *server)
struct mxq_group *group;
struct mxq_job *job;

if (!server->user_cnt)
return;

mx_log_info("====================== SERVER DUMP START ======================");
for (ulist = server->users; ulist; ulist = ulist->next) {
if (!ulist->groups) {
Expand Down Expand Up @@ -2300,6 +2297,17 @@ static void process_signal(struct mxq_server *server,int sig,int extra)
mx_log_info("received sigusr2");
global_sigrestart_cnt++;
break;
case SIGUSR2:
switch (extra) {
case 10:
mx_log_info("received sigusr2 extra %d (dump)",extra);
server_dump(server);
break;
default:
mx_log_warning("received sigusr2 extra %d (unexpected!)",extra);
break;
}
break;
case SIGCHLD:
mx_log_info("received sigchld");
break;
Expand Down

0 comments on commit 8660ae5

Please sign in to comment.