Browse Source

Merge branch 'develop' into feature/data-refactor

pull/2217/head
Daniel Gibbs 8 years ago
parent
commit
30eb5f046f
  1. 2
      .github/support.yml
  2. BIN
      lgsm/data/alert_discord_logo.png
  3. 6
      lgsm/functions/alert_discord.sh
  4. 2
      lgsm/functions/check_status.sh
  5. 2
      lgsm/functions/command_console.sh
  6. 5
      lgsm/functions/command_debug.sh
  7. 43
      lgsm/functions/command_start.sh
  8. 34
      lgsm/functions/command_stop.sh

2
.github/support.yml

@ -1,7 +1,7 @@
# Configuration for support-requests - https://github.com/dessant/support-requests
# Label used to mark issues as support requests
supportLabel: Type: support
supportLabel: "Type: support"
# Comment to post on issues marked as support requests. Add a link
# to a support page, or set to `false` to disable
supportComment: >

BIN
lgsm/data/alert_discord_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

6
lgsm/functions/alert_discord.sh

@ -8,7 +8,7 @@
json=$(cat <<EOF
{
"username":"LinuxGSM",
"avatar_url":"https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/images/logo/lgsm-dark-square-512.png",
"avatar_url":"https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/data/alert_discord_logo.png",
"file":"content",
"embeds": [{
@ -18,8 +18,8 @@ json=$(cat <<EOF
"description": "",
"url": "",
"type": "content",
"thumbnail": {"url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/images/logo/lgsm-dark-square-512.png"},
"footer": {"text": "LinuxGSM", "icon_url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/images/logo/lgsm-dark-square-512.png"},
"thumbnail": {"url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/data/alert_discord_logo.png"},
"footer": {"text": "LinuxGSM", "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/data/alert_discord_logo.png"},
"fields": [
{
"name": "Alert Message",

2
lgsm/functions/check_status.sh

@ -32,5 +32,5 @@ elif [ "${gamename}" == "Mumble" ]; then
status=1
fi
else
status=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
status=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${servicename}")
fi

2
lgsm/functions/command_console.sh

@ -30,7 +30,7 @@ if [ "${status}" != "0" ]; then
fn_print_ok_nl "Accessing console"
fn_script_log_pass "Console accessed"
sleep 0.5
tmux attach-session -t="${servicename}"
tmux attach-session -t "${servicename}"
fn_print_ok_nl "Closing console"
fn_script_log_pass "Console closed"
else

5
lgsm/functions/command_debug.sh

@ -96,15 +96,16 @@ fn_script_log_info "${rootdir}/${lockselfname}"
trap fn_lockfile_trap INT
cd "${executabledir}" || exit
# Note: do not add double quotes to ${executable} ${parms}
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
${executable} ${parms} -debug
elif [ "${engine}" == "realvirtuality" ]; then
# Arma3 requires semicolons in the module list, which need to
# be escaped for regular (tmux) loading, but need to be
# stripped when loading straight from the console.
"${executable}" "${parms//\\;/;}"
${executable} ${parms//\\;/;}
else
"${executable}" "${parms}"
${executable} ${parms}
fi
fn_print_dots "Stopping debug"

43
lgsm/functions/command_start.sh

@ -25,14 +25,6 @@ fn_start_teamspeak3(){
touch "${servercfgfullpath}"
fi
sleep 0.5
check_status.sh
if [ "${status}" != "0" ]; then
fn_print_info_nl "${servername} is already running"
fn_script_log_error "${servername} is already running"
if [ -z "${exitbypass}" ]; then
core_exit.sh
fi
fi
if [ -f "${lgsmlog}" ]; then
mv "${lgsmlog}" "${lgsmlogdate}"
fi
@ -81,26 +73,15 @@ fn_start_tmux(){
fi
# Log rotation
check_status.sh
if [ "${status}" == "0" ]; then
fn_script_log_info "Rotating log files"
if [ "${engine}" == "unreal2" ]; then
if [ -f "${gamelog}" ]; then
if [ "${engine}" == "unreal2" ]&&[ -f "${gamelog}" ]; then
mv "${gamelog}" "${gamelogdate}"
fi
fi
if [ -f "${lgsmlog}" ]; then
mv "${lgsmlog}" "${lgsmlogdate}"
mv "${consolelog}" "${consolelogdate}"
fi
# If server is already running exit
check_status.sh
if [ "${status}" != "0" ]; then
fn_print_info_nl "${servername} is already running"
fn_script_log_error "${servername} is already running"
if [ -z "${exitbypass}" ]; then
core_exit.sh
fi
if [ -f "${consolelog}" ]; then
mv "${consolelog}" "${consolelogdate}"
fi
# Create lockfile
@ -118,7 +99,7 @@ fn_start_tmux(){
fn_script_log "Tmux version: master (user compiled)"
echo "Tmux version: master (user compiled)" >> "${consolelog}"
if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
tmux pipe-pane -o -t="${servicename}" "exec cat >> '${consolelog}'"
tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
fi
elif [ -n "${tmuxversion}" ]; then
# Get the digit version of tmux
@ -136,7 +117,7 @@ fn_start_tmux(){
Currently installed: $(tmux -V)" > "${consolelog}"
# Console logging enable or not set
elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
tmux pipe-pane -o -t="${servicename}" "exec cat >> '${consolelog}'"
tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
fi
else
echo "Unable to detect tmux version" >> "${consolelog}"
@ -209,17 +190,23 @@ sleep 0.5
fn_print_dots "${servername}"
sleep 0.5
check.sh
# Is the server already started
if [ "${status}" != "0" ]; then # $status comes from check_status.sh, which is run by check.sh for this command
fn_print_info_nl "${servername} is already running"
fn_script_log_error "${servername} is already running"
if [ -z "${exitbypass}" ]; then
core_exit.sh
fi
fi
fix.sh
info_config.sh
logs.sh
# Will check for updates is updateonstart is yes
if [ "${status}" == "0" ]; then
if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
exitbypass=1
unset updateonstart
command_update.sh
fi
fi
if [ "${gamename}" == "TeamSpeak 3" ]; then

34
lgsm/functions/command_stop.sh

@ -34,7 +34,6 @@ fn_stop_graceful_ctrlc(){
fn_script_log_error "Graceful: CTRL+c: FAIL"
fi
sleep 0.5
fn_stop_tmux
}
# Attempts graceful shutdown by sending a specified command.
@ -64,7 +63,6 @@ fn_stop_graceful_cmd(){
fn_script_log_error "Graceful: sending \"${1}\": FAIL"
fi
sleep 0.5
fn_stop_tmux
}
# Attempts graceful of goldsource using rcon 'quit' command.
@ -85,7 +83,6 @@ fn_stop_graceful_goldsource(){
fn_print_ok_eol_nl
fn_script_log_pass "Graceful: sending \"quit\": OK: ${seconds} seconds"
sleep 0.5
fn_stop_tmux
}
# Attempts graceful of 7 Days To Die using telnet.
@ -174,7 +171,6 @@ fn_stop_graceful_sdtd(){
fn_script_log_warn "Graceful: telnet: expect not installed: FAIL"
fi
sleep 0.5
fn_stop_tmux
}
fn_stop_graceful_select(){
@ -195,8 +191,6 @@ fn_stop_graceful_select(){
fn_stop_graceful_ctrlc
elif [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${engine}" == "Just Cause 2" ]||[ "${engine}" == "projectzomboid" ]||[ "${shortname}" == "rw" ]; then
fn_stop_graceful_cmd "quit" 30
else
fn_stop_tmux
fi
}
@ -263,12 +257,10 @@ fn_stop_tmux(){
fn_script_log_info "tmux kill-session: ${servername}"
sleep 0.5
# Kill tmux session
tmux kill-session -t="${servicename}" > /dev/null 2>&1
tmux kill-session -t "${servicename}" > /dev/null 2>&1
sleep 0.5
check_status.sh
if [ "${status}" == "0" ]; then
# Remove lockfile
rm -f "${rootdir}/${lockselfname}"
# ARK doesn't clean up immediately after tmux is killed.
# Make certain the ports are cleared before continuing.
if [ "${gamename}" == "ARK: Survival Evolved" ]; then
@ -277,28 +269,26 @@ fn_stop_tmux(){
fn_print_ok_nl "${servername}"
fn_script_log_pass "Stopped ${servername}"
else
fn_print_fail_nl "Unable to stop${servername}"
fn_script_log_fatal "Unable to stop${servername}"
fn_print_fail_nl "Unable to stop ${servername}"
fn_script_log_fatal "Unable to stop ${servername}"
fi
}
# checks if the server is already stopped before trying to stop.
fn_stop_pre_check(){
if [ "${gamename}" == "TeamSpeak 3" ]; then
check_status.sh
if [ "${status}" == "0" ]; then
# Is the server already stopped
if [ "${status}" == "0" ]; then # $status comes from check_status.sh, which is run by check.sh for this command
fn_print_info_nl "${servername} is already stopped"
fn_script_log_error "${servername} is already stopped"
else
elif [ "${gamename}" == "TeamSpeak 3" ]; then
fn_stop_teamspeak3
fi
else
if [ "${status}" == "0" ]; then
fn_print_info_nl "${servername} is already stopped"
fn_script_log_error "${servername} is already stopped"
else
fn_stop_graceful_select
fi
# Check status again, a stop tmux session if needed
check_status.sh
if [ "${status}" != "0" ]; then
fn_stop_tmux
fi
}
@ -307,4 +297,8 @@ sleep 0.5
check.sh
info_config.sh
fn_stop_pre_check
# Remove lockfile
if [ -f "${rootdir}/${lockselfname}" ]; then
rm -f "${rootdir}/${lockselfname}"
fi
core_exit.sh

Loading…
Cancel
Save