Browse Source

minor changes

pull/3288/head
Daniel Gibbs 5 years ago
parent
commit
3f6b8e0165
  1. 21
      lgsm/functions/command_send.sh
  2. 8
      lgsm/functions/core_getopt.sh
  3. 11
      lgsm/functions/core_messages.sh

21
lgsm/functions/command_send.sh

@ -1,12 +1,11 @@
#!/bin/bash
# LinuxGSM command_send.sh function
# Author: Duval Lucas
# LinuxGSM command_send.sh module
# Author: Daniel Gibbs
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Send command to the server tmux console.
local commandname="SEND"
local commandaction="Send"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
check.sh
if [ -z "${userinput2}" ]; then
@ -17,15 +16,15 @@ fi
check_status.sh
if [ "${status}" != "0" ]; then
if [ -n "${userinput2}" ]; then
command_to_send="${userinput2}"
commandtosend="${userinput2}"
else
echo ""
command_to_send=$( fn_prompt_message "send: " )
commandtosend=$( fn_prompt_message "send: " )
fi
fn_print_dots "Sending command to console: \"${command_to_send}\""
tmux send-keys -t "${servicename}" "${command_to_send}" ENTER
fn_print_ok_nl "Sending command to console: \"${command_to_send}\""
fn_script_log_pass "Command \"${command_to_send}\" sent to console"
fn_print_dots "Sending command to console: \"${commandtosend}\""
tmux send-keys -t "${servicename}" "${commandtosend}" ENTER
fn_print_ok_nl "Sending command to console: \"${commandtosend}\""
fn_script_log_pass "Command \"${commandtosend}\" sent to console"
else
fn_print_error_nl "Server not running"
fn_script_log_error "Failed to access: Server not running"

8
lgsm/functions/core_getopt.sh

@ -23,7 +23,7 @@ cmd_test_alert=( "ta;test-alert" "command_test_alert.sh" "Send a test alert." )
cmd_monitor=( "m;monitor" "command_monitor.sh" "Check server status and restart if crashed." )
cmd_skeleton=( "sk;skeleton" "command_skeleton.sh" "Create a skeleton directory." )
cmd_donate=( "do;donate" "command_donate.sh" "Donation options." )
cmd_send=( "sd;send" "command_send.sh" "Send command to server console." )
cmd_send=( "sd;send" "command_send.sh" "Send command to game server console." )
# Console servers only.
cmd_console=( "c;console" "command_console.sh" "Access server console." )
cmd_debug=( "d;debug" "command_debug.sh" "Start server directly in your terminal." )
@ -83,11 +83,11 @@ fi
# Backup.
currentopt+=( "${cmd_backup[@]}" )
# Console & Debug
# Console & Debug.
currentopt+=( "${cmd_console[@]}" "${cmd_debug[@]}" )
# Exclude game servers that dont support send
if [ "${shortname}" != "rust" ]||[ "${shortname}" != "hw" ]||[ "${shortname}" != "ark" ]||[ "${shortname}" != "ts3" ]; then
# Console send.
if [ "${consoleinteract}" == "yes" ]; then
currentopt+=( "${cmd_send[@]}" )
fi

11
lgsm/functions/core_messages.sh

@ -362,14 +362,13 @@ fn_prompt_yn(){
# Prompt for message
fn_prompt_message(){
local prompt="$1"
while true; do
read -e -p "${prompt}" -r answer
if fn_prompt_yn "\"${answer}\", is this correct ?" Y; then
break;
fi
read -e -p "${prompt}" -r answer
if fn_prompt_yn "\"${answer}\", is this correct ?" Y; then
break;
fi
done
echo "${answer}"
echo "${answer}"
}

Loading…
Cancel
Save