File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ if [ "${ramrequirementmb}" ]; then
4949 fn_print_dots " Check RAM"
5050 # Warn the user.
5151 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."
5353 fn_sleep_time
5454 fi
5555fi
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]}"
180180fn_fetch_function
181181}
182182
183+ command_send.sh (){
184+ functionfile=" ${FUNCNAME[0]} "
185+ fn_fetch_function
186+ }
187+
183188# Checks
184189
185190check.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." )
2323cmd_monitor=( " m;monitor" " command_monitor.sh" " Check server status and restart if crashed." )
2424cmd_skeleton=( " sk;skeleton" " command_skeleton.sh" " Create a skeleton directory." )
2525cmd_donate=( " do;donate" " command_donate.sh" " Donation options." )
26+ cmd_send=( " sd;send" " command_send.sh" " Send command to game server console." )
2627# Console servers only.
2728cmd_console=( " c;console" " command_console.sh" " Access server console." )
2829cmd_debug=( " d;debug" " command_debug.sh" " Start server directly in your terminal." )
8283# Backup.
8384currentopt+=( " ${cmd_backup[@]} " )
8485
85- # Console & Debug
86+ # Console & Debug.
8687currentopt+=( " ${cmd_console[@]} " " ${cmd_debug[@]} " )
8788
89+ # Console send.
90+ if [ " ${consoleinteract} " == " yes" ]; then
91+ currentopt+=( " ${cmd_send[@]} " )
92+ fi
93+
8894# # Game server exclusive commands.
8995
9096# FastDL command.
Original file line number Diff line number Diff line change @@ -359,6 +359,19 @@ fn_prompt_yn(){
359359 done
360360}
361361
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+
362375# On-Screen End of Line
363376# #################################
364377
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ configdir="${lgsmdir}/config-lgsm"
4242configdirserver=" ${configdir} /${gameservername} "
4343configdirdefault=" ${lgsmdir} /config-default"
4444userinput=" ${1} "
45+ userinput2=" ${2} "
4546
4647# # GitHub Branch Select
4748# Allows for the use of different function files
You can’t perform that action at this time.
0 commit comments