From 2c273e359130f6546aa471ffd0f1855d415a05c5 Mon Sep 17 00:00:00 2001 From: Matt Stancliff Date: Thu, 20 Feb 2014 23:45:56 -0500 Subject: [PATCH] Add cluster or sentinel to proc title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If you launch redis with `redis-server --sentinel` then in a ps, your output only says "redis-server IP:Port" — this patch changes the proc title to include [sentinel] or [cluster] depending on the current server mode: e.g. "redis-server IP:Port [sentinel]" "redis-server IP:Port [cluster]" --- src/redis.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/redis.c b/src/redis.c index 0d1686a02..c8562c85d 100644 --- a/src/redis.c +++ b/src/redis.c @@ -3079,10 +3079,15 @@ void redisOutOfMemoryHandler(size_t allocation_size) { void redisSetProcTitle(char *title) { #ifdef USE_SETPROCTITLE - setproctitle("%s %s:%d", + char *server_mode = ""; + if (server.cluster_enabled) server_mode = " [cluster]"; + else if (server.sentinel_mode) server_mode = " [sentinel]"; + + setproctitle("%s %s:%d%s", title, server.bindaddr_count ? server.bindaddr[0] : "*", - server.port); + server.port, + server_mode); #else REDIS_NOTUSED(title); #endif