From ef410be0c504c43f850c25394c820e6a7218d538 Mon Sep 17 00:00:00 2001 From: Marcus Whybrow Date: Wed, 30 May 2012 16:58:56 +0100 Subject: [PATCH] Added the server "cmd" and "cmdlog" commands. Closes #8. --- msm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/msm b/msm index 0f88c57..460f985 100755 --- a/msm +++ b/msm @@ -1720,8 +1720,29 @@ main() { save) ;; cmd) + if [ -z "$3" ]; then + echo "Invalid command." + else + if server_is_running $id; then + server_eval $id "${*:3}" + echo "Command sent." + else + echo "Server \"${server_name[$id]}\" is not running." + fi + fi ;; cmdlog) + if [ -z "$3" ]; then + echo "Invalid command." + else + if server_is_running $id; then + server_eval $id "${*:3}" + echo "Now watching logs (press Ctrl+C to exit):" + as_user ${server_user_name[$id]} "tail --follow --lines=0 --sleep-interval=0.1 ${server_log[$id]}" + else + echo "Server \"${server_name[$id]}\" is not running." + fi + fi ;; *) echo "Invalid command."