From 55050dc43bd0b7a5fc4f23fce2ea68507d24e3fc Mon Sep 17 00:00:00 2001 From: Paulo Koch Date: Fri, 16 Oct 2015 17:41:03 -0700 Subject: [PATCH] Don't try to kill if nothing was forgotten --- contrib/find_forgotten_procs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/find_forgotten_procs.py b/contrib/find_forgotten_procs.py index 352c58b2f..ed23b98de 100644 --- a/contrib/find_forgotten_procs.py +++ b/contrib/find_forgotten_procs.py @@ -200,13 +200,14 @@ def main(command, tron_base, *target_service_names, **options): ) pprint(results) - print "Total instances", sum( + forgotten_count = sum( len(pids) for service_pid_pairs in results.itervalues() for _, pids in service_pid_pairs ) + print "Total instances", forgotten_count - if command == 'kill': + if forgotten_count and command == 'kill': execute( parallel(kill_forgotten), results,