]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm service status: Add doveadm_stop field
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 19 Jul 2017 18:24:48 +0000 (21:24 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Tue, 25 Jul 2017 13:48:45 +0000 (16:48 +0300)
This indicates whether "doveadm service stop" was used for the service.

src/doveadm/doveadm-master.c
src/master/master-client.c
src/master/service.h

index bbe4f261adbf0e253f83ee40c52259cad5a0a18e..6cbee620af27252bd79b695b0cfbc0a9a3a873b2 100644 (file)
@@ -170,6 +170,7 @@ static void cmd_service_status(struct doveadm_cmd_context *cctx)
        doveadm_print_header_simple("last_drop_warning");
        doveadm_print_header_simple("listen_pending");
        doveadm_print_header_simple("listening");
+       doveadm_print_header_simple("doveadm_stop");
 
        alarm(5);
        while ((line = i_stream_read_next_line(input)) != NULL) {
@@ -177,10 +178,10 @@ static void cmd_service_status(struct doveadm_cmd_context *cctx)
                        break;
                T_BEGIN {
                        const char *const *args = t_strsplit_tabescaped(line);
-                       if (str_array_length(args) >= 11 &&
+                       if (str_array_length(args) >= 12 &&
                            (services == NULL ||
                             str_array_find(services, args[0]))) {
-                               for (unsigned int i = 0; i < 11; i++)
+                               for (unsigned int i = 0; i < 12; i++)
                                        doveadm_print(args[i]);
                        }
                } T_END;
index 2b8084d9b0569d4f8f4b0dd3a03794ab271f8228..0415c87a19f9c66f75eccf893964f02ebd4562c7 100644 (file)
@@ -20,7 +20,7 @@ master_client_service_status_output(string_t *str,
                                    const struct service *service)
 {
        str_append_tabescaped(str, service->set->name);
-       str_printfa(str, "\t%u\t%u\t%u\t%u\t%u\t%ld\t%u\t%ld\t%c\t%c\n",
+       str_printfa(str, "\t%u\t%u\t%u\t%u\t%u\t%ld\t%u\t%ld\t%c\t%c\t%c\n",
                    service->process_count, service->process_avail,
                    service->process_limit, service->client_limit,
                    service->to_throttle == NULL ? 0 : service->throttle_secs,
@@ -28,7 +28,8 @@ master_client_service_status_output(string_t *str,
                    service->exit_failures_in_sec,
                    (long)service->last_drop_warning,
                    service->listen_pending ? 'y' : 'n',
-                   service->listening ? 'y' : 'n');
+                   service->listening ? 'y' : 'n',
+                   service->doveadm_stop ? 'y' : 'n');
 }
 
 static int
@@ -90,8 +91,10 @@ master_client_stop(struct master_client *client, const char *const *args)
                service = service_lookup(services, args[i]);
                if (service == NULL)
                        reply = t_strdup_printf("-Unknown service: %s\n", args[i]);
-               else
+               else {
                        service_monitor_stop_close(service);
+                       service->doveadm_stop = TRUE;
+               }
        }
        o_stream_send_str(client->conn.output, reply);
        return 1;
index 1df29b002b1e06d510b11bef449bae20aa687bd3..c2f3ee65f0d4cbbab2b875840ae4d51d725501ec 100644 (file)
@@ -121,6 +121,8 @@ struct service {
        bool last_login_full_notify:1;
        /* service has exited at least once with exit code 0 */
        bool have_successful_exits:1;
+       /* service was stopped via doveadm */
+       bool doveadm_stop:1;
 };
 
 struct service_list {