From 828f108be1eb1227360ba63b76a4d3931a9515d6 Mon Sep 17 00:00:00 2001 From: Marcus Whybrow Date: Thu, 31 May 2012 02:26:13 +0100 Subject: [PATCH] Fixed two bugs in the interrupt handler. It would always find the stop and restart counters for a server to be running, and then always print out the server name of used in the command, even if it was another server being stopped prematurely. --- msm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/msm b/msm index 221e269..9068892 100755 --- a/msm +++ b/msm @@ -1356,21 +1356,22 @@ init() { interrupt() { local exit_message="false" for ((i=0; $i<$num_servers; i++)); do - if [[ "${STOP_COUNTDOWN[$i]}" ]] && server_is_running $i; then + if [[ "${STOP_COUNTDOWN[$i]}" == "true" ]] && server_is_running $i; then if [[ "$exit_message" == "false" ]]; then echo -e "\nInterrupted..." exit_message="true" fi server_eval $i "say ${server_stop_abort[$i]}" - echo "Server \"${server_name[$id]}\" shutdown was aborted." + echo "Server \"${server_name[$i]}\" shutdown was aborted." fi - if [[ "${RESTART_COUNTDOWN[$i]}" ]] && server_is_running $i; then + + if [[ "${RESTART_COUNTDOWN[$i]}" == "true" ]] && server_is_running $i; then if [[ "$exit_message" == "false" ]]; then echo -e "\nInterrupted..." exit_message="true" fi server_eval $i "say ${server_restart_abort[$i]}" - echo "Server \"${server_name[$id]}\" restart was aborted." + echo "Server \"${server_name[$i]}\" restart was aborted." fi done exit