Added the server "cmd" and "cmdlog" commands. Closes #8.

This commit is contained in:
Marcus Whybrow 2012-05-30 16:58:56 +01:00
parent 2540c43e8a
commit ef410be0c5

21
msm
View File

@ -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."