-
-
Notifications
You must be signed in to change notification settings - Fork 861
Expand file tree
/
Copy pathcommand_send.sh
More file actions
37 lines (33 loc) · 1.08 KB
/
command_send.sh
File metadata and controls
37 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# LinuxGSM command_send.sh module
# Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Send command to the server tmux console.
commandname="SEND"
commandaction="Send"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set
check.sh
if [ -z "${userinput2}" ]; then
fn_print_header
fn_print_information_nl "Send a command to the console."
fi
check_status.sh
if [ "${status}" != "0" ]; then
if [ -n "${userinput2}" ]; then
commandtosend="${userinput2}"
else
echo ""
commandtosend=$(fn_prompt_message "send: ")
fi
echo ""
fn_print_dots "Sending command to console: \"${commandtosend}\""
fn_print_ok_nl "Sending command to console: \"${commandtosend}\""
TERM=screen tmux -L "${socketname}" send-keys -t "${sessionname}" "${commandtosend}" ENTER
fn_script_log_pass "Command \"${commandtosend}\" sent to console"
else
fn_print_error_nl "Unable to send command to console. Server not running"
fn_script_log_error "Unable to send command to console. Server not running"
fi
core_exit.sh