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. 1
      lgsm/functions/core_messages.sh

21
lgsm/functions/command_send.sh

@ -1,12 +1,11 @@
#!/bin/bash #!/bin/bash
# LinuxGSM command_send.sh function # LinuxGSM command_send.sh module
# Author: Duval Lucas # Author: Daniel Gibbs
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Send command to the server tmux console. # Description: Send command to the server tmux console.
local commandname="SEND" functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
local commandaction="Send"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
check.sh check.sh
if [ -z "${userinput2}" ]; then if [ -z "${userinput2}" ]; then
@ -17,15 +16,15 @@ fi
check_status.sh check_status.sh
if [ "${status}" != "0" ]; then if [ "${status}" != "0" ]; then
if [ -n "${userinput2}" ]; then if [ -n "${userinput2}" ]; then
command_to_send="${userinput2}" commandtosend="${userinput2}"
else else
echo "" echo ""
command_to_send=$( fn_prompt_message "send: " ) commandtosend=$( fn_prompt_message "send: " )
fi fi
fn_print_dots "Sending command to console: \"${command_to_send}\"" fn_print_dots "Sending command to console: \"${commandtosend}\""
tmux send-keys -t "${servicename}" "${command_to_send}" ENTER tmux send-keys -t "${servicename}" "${commandtosend}" ENTER
fn_print_ok_nl "Sending command to console: \"${command_to_send}\"" fn_print_ok_nl "Sending command to console: \"${commandtosend}\""
fn_script_log_pass "Command \"${command_to_send}\" sent to console" fn_script_log_pass "Command \"${commandtosend}\" sent to console"
else else
fn_print_error_nl "Server not running" fn_print_error_nl "Server not running"
fn_script_log_error "Failed to access: 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_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_skeleton=( "sk;skeleton" "command_skeleton.sh" "Create a skeleton directory." )
cmd_donate=( "do;donate" "command_donate.sh" "Donation options." ) 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. # Console servers only.
cmd_console=( "c;console" "command_console.sh" "Access server console." ) cmd_console=( "c;console" "command_console.sh" "Access server console." )
cmd_debug=( "d;debug" "command_debug.sh" "Start server directly in your terminal." ) cmd_debug=( "d;debug" "command_debug.sh" "Start server directly in your terminal." )
@ -83,11 +83,11 @@ fi
# Backup. # Backup.
currentopt+=( "${cmd_backup[@]}" ) currentopt+=( "${cmd_backup[@]}" )
# Console & Debug # Console & Debug.
currentopt+=( "${cmd_console[@]}" "${cmd_debug[@]}" ) currentopt+=( "${cmd_console[@]}" "${cmd_debug[@]}" )
# Exclude game servers that dont support send # Console send.
if [ "${shortname}" != "rust" ]||[ "${shortname}" != "hw" ]||[ "${shortname}" != "ark" ]||[ "${shortname}" != "ts3" ]; then if [ "${consoleinteract}" == "yes" ]; then
currentopt+=( "${cmd_send[@]}" ) currentopt+=( "${cmd_send[@]}" )
fi fi

1
lgsm/functions/core_messages.sh

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

Loading…
Cancel
Save