Browse Source
* add send command Added a function to send command directly to the console If the user don't provide a command right after the "send" argument, he will be prompt to enter a command * updates to messages converted spaces to tabs * minor * minor * messages only display if manual entry * updated description * send will not show if not supported * corrected if changed to ! * ui updates * ui changes * Update core_getopt.sh Co-authored-by: Daniel Gibbs <[email protected]> Co-authored-by: Frisasky <[email protected]>pull/3288/head
committed by
GitHub
5 changed files with 64 additions and 0 deletions
@ -0,0 +1,38 @@ |
|||
#!/bin/bash |
|||
# LinuxGSM command_send.sh function |
|||
# Author: Duval Lucas |
|||
# 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]}")")" |
|||
|
|||
check.sh |
|||
if [ -z "${userinput2}" ]; then |
|||
fn_print_header |
|||
fn_print_information_nl "Send allows a command to be sent to the console." |
|||
fi |
|||
|
|||
check_status.sh |
|||
if [ "${status}" != "0" ]; then |
|||
if [ -n "${userinput2}" ]; then |
|||
command_to_send="${userinput2}" |
|||
else |
|||
echo "" |
|||
command_to_send=$( 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" |
|||
else |
|||
fn_print_error_nl "Server not running" |
|||
fn_script_log_error "Failed to access: Server not running" |
|||
if fn_prompt_yn "Do you want to start the server?" Y; then |
|||
exitbypass=1 |
|||
command_start.sh |
|||
fi |
|||
fi |
|||
|
|||
core_exit.sh |
Loading…
Reference in new issue