File tree 6 files changed +68
-2
lines changed
6 files changed +68
-2
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ if [ "${ramrequirementmb}" ]; then
49
49
fn_print_dots " Check RAM"
50
50
# Warn the user.
51
51
fn_print_warn_nl " Check RAM: ${ramrequirementgb} G required, ${physmemtotal} available"
52
- echo " * ${gamename} server may fail to run or experience poor performance."
52
+ echo " * ${gamename} server may fail to run or experience poor performance."
53
53
fn_sleep_time
54
54
fi
55
55
fi
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # LinuxGSM command_send.sh module
3
+ # Author: Daniel Gibbs
4
+ # Contributors: http://linuxgsm.com/contrib
5
+ # Website: https://linuxgsm.com
6
+ # Description: Send command to the server tmux console.
7
+
8
+ commandname=" SEND"
9
+ commandaction=" Send"
10
+ functionselfname=" $( basename " $( readlink -f " ${BASH_SOURCE[0]} " ) " ) "
11
+ fn_firstcommand_set
12
+
13
+ check.sh
14
+ if [ -z " ${userinput2} " ]; then
15
+ fn_print_header
16
+ fn_print_information_nl " Send a command to the console."
17
+ fi
18
+
19
+ check_status.sh
20
+ if [ " ${status} " != " 0" ]; then
21
+ if [ -n " ${userinput2} " ]; then
22
+ commandtosend=" ${userinput2} "
23
+ else
24
+ echo " "
25
+ commandtosend=$( fn_prompt_message " send: " )
26
+ fi
27
+ echo " "
28
+ fn_print_dots " Sending command to console: \" ${commandtosend} \" "
29
+ tmux send-keys -t " ${servicename} " " ${commandtosend} " ENTER
30
+ fn_print_ok_nl " Sending command to console: \" ${commandtosend} \" "
31
+ fn_script_log_pass " Command \" ${commandtosend} \" sent to console"
32
+ else
33
+ fn_print_error_nl " Server not running"
34
+ fn_script_log_error " Failed to access: Server not running"
35
+ if fn_prompt_yn " Do you want to start the server?" Y; then
36
+ exitbypass=1
37
+ command_start.sh
38
+ fi
39
+ fi
40
+
41
+ core_exit.sh
Original file line number Diff line number Diff line change @@ -180,6 +180,11 @@ functionfile="${FUNCNAME[0]}"
180
180
fn_fetch_function
181
181
}
182
182
183
+ command_send.sh (){
184
+ functionfile=" ${FUNCNAME[0]} "
185
+ fn_fetch_function
186
+ }
187
+
183
188
# Checks
184
189
185
190
check.sh (){
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ cmd_test_alert=( "ta;test-alert" "command_test_alert.sh" "Send a test alert." )
23
23
cmd_monitor=( " m;monitor" " command_monitor.sh" " Check server status and restart if crashed." )
24
24
cmd_skeleton=( " sk;skeleton" " command_skeleton.sh" " Create a skeleton directory." )
25
25
cmd_donate=( " do;donate" " command_donate.sh" " Donation options." )
26
+ cmd_send=( " sd;send" " command_send.sh" " Send command to game server console." )
26
27
# Console servers only.
27
28
cmd_console=( " c;console" " command_console.sh" " Access server console." )
28
29
cmd_debug=( " d;debug" " command_debug.sh" " Start server directly in your terminal." )
82
83
# Backup.
83
84
currentopt+=( " ${cmd_backup[@]} " )
84
85
85
- # Console & Debug
86
+ # Console & Debug.
86
87
currentopt+=( " ${cmd_console[@]} " " ${cmd_debug[@]} " )
87
88
89
+ # Console send.
90
+ if [ " ${consoleinteract} " == " yes" ]; then
91
+ currentopt+=( " ${cmd_send[@]} " )
92
+ fi
93
+
88
94
# # Game server exclusive commands.
89
95
90
96
# FastDL command.
Original file line number Diff line number Diff line change @@ -359,6 +359,19 @@ fn_prompt_yn(){
359
359
done
360
360
}
361
361
362
+ # Prompt for message
363
+ fn_prompt_message (){
364
+ while true ; do
365
+ unset prompt
366
+ local prompt=" $1 "
367
+ read -e -p " ${prompt} " -r answer
368
+ if fn_prompt_yn " Continue" Y; then
369
+ break ;
370
+ fi
371
+ done
372
+ echo " ${answer} "
373
+ }
374
+
362
375
# On-Screen End of Line
363
376
# #################################
364
377
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ configdir="${lgsmdir}/config-lgsm"
42
42
configdirserver=" ${configdir} /${gameservername} "
43
43
configdirdefault=" ${lgsmdir} /config-default"
44
44
userinput=" ${1} "
45
+ userinput2=" ${2} "
45
46
46
47
# # GitHub Branch Select
47
48
# Allows for the use of different function files
You can’t perform that action at this time.
0 commit comments