... | ... |
@@ -684,6 +684,17 @@ static int uptime_fifo_cmd( FILE *stream, char *response_file ) |
684 | 684 |
return 1; |
685 | 685 |
} |
686 | 686 |
|
687 |
+static int kill_fifo_cmd( FILE *stream, char *response_file ) |
|
688 |
+{ |
|
689 |
+ if (response_file==0 || *response_file==0 ) { |
|
690 |
+ LOG(L_ERR, "ERROR: uptime_fifo_cmd: null file\n"); |
|
691 |
+ return -1; |
|
692 |
+ } |
|
693 |
+ fifo_reply(response_file, "200 killing now..." ); |
|
694 |
+ kill(0, SIGTERM); |
|
695 |
+ return 1; |
|
696 |
+} |
|
697 |
+ |
|
687 | 698 |
static int which_fifo_cmd(FILE *stream, char *response_file ) |
688 | 699 |
{ |
689 | 700 |
FILE *reply_pipe; |
... | ... |
@@ -765,5 +776,9 @@ int register_core_fifo() |
765 | 776 |
LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_PS); |
766 | 777 |
return -1; |
767 | 778 |
} |
779 |
+ if (register_fifo_cmd(kill_fifo_cmd, FIFO_KILL, 0)<0) { |
|
780 |
+ LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_KILL); |
|
781 |
+ return -1; |
|
782 |
+ } |
|
768 | 783 |
return 1; |
769 | 784 |
} |