Browse Source

renamed scriptlog to lgsmlog

Since there are so many types of logs beign used now changing script to lgsm will clarify what you are working with
pull/1477/head
Daniel Gibbs 8 years ago
parent
commit
a7e79a5350
  1. 8
      lgsm/config-default/config-lgsm/arkserver/_default.cfg
  2. 9
      lgsm/config-default/config-lgsm/arma3server/_default.cfg
  3. 8
      lgsm/config-default/config-lgsm/csgoserver/_default.cfg
  4. 9
      lgsm/config-default/config-lgsm/sdtdserver/_default.cfg
  5. 14
      lgsm/functions/alert_email.sh
  6. 2
      lgsm/functions/check_executable.sh
  7. 2
      lgsm/functions/check_logs.sh
  8. 4
      lgsm/functions/check_permissions.sh
  9. 2
      lgsm/functions/check_root.sh
  10. 4
      lgsm/functions/check_steamcmd.sh
  11. 2
      lgsm/functions/check_system_dir.sh
  12. 4
      lgsm/functions/command_backup.sh
  13. 18
      lgsm/functions/command_start.sh
  14. 8
      lgsm/functions/command_stop.sh
  15. 4
      lgsm/functions/command_validate.sh
  16. 12
      lgsm/functions/core_dl.sh
  17. 36
      lgsm/functions/core_messages.sh
  18. 14
      lgsm/functions/fix_steamcmd.sh
  19. 10
      lgsm/functions/install_logs.sh
  20. 36
      lgsm/functions/logs.sh
  21. 6
      lgsm/functions/update_steamcmd.sh
  22. 6
      linuxgsm.sh
  23. 8
      tests/tests_jc2server.sh
  24. 8
      tests/tests_ts3server.sh

8
lgsm/config-default/config-lgsm/arkserver/_default.cfg

@ -79,12 +79,12 @@ backupdir="${lgsmdir}/backup"
## Logging Directories
logdir="${logdir}"
gamelogdir="${systemdir}/Saved/Logs"
scriptlogdir="${logdir}/script"
lgsmlogdir="${logdir}/script"
consolelogdir="${logdir}/console"
scriptlog="${scriptlogdir}/${servicename}-script.log"
lgsmlog="${lgsmlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
emaillog="${scriptlogdir}/${servicename}-email.log"
emaillog="${lgsmlogdir}/${servicename}-email.log"
## Logs Naming
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

9
lgsm/config-default/config-lgsm/arma3server/_default.cfg

@ -88,13 +88,14 @@ networkcfgfullpath="${servercfgdir}/${networkcfg}"
backupdir="${lgsmdir}/backup"
## Logging Directories
logdir="${logdir}"
#gamelogdir="" # No server logs available
scriptlogdir="${logdir}/script"
lgsmlogdir="${logdir}/script"
consolelogdir="${logdir}/console"
scriptlog="${scriptlogdir}/${servicename}-script.log"
lgsmlog="${lgsmlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
emaillog="${scriptlogdir}/${servicename}-email.log"
emaillog="${lgsmlogdir}/${servicename}-email.log"
## Logs Naming
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

8
lgsm/config-default/config-lgsm/csgoserver/_default.cfg

@ -102,12 +102,12 @@ backupdir="${lgsmdir}/backup"
## Logging Directories
gamelogdir="${systemdir}/logs"
scriptlogdir="${logdir}/script"
lgsmlogdir="${logdir}/script"
consolelogdir="${logdir}/console"
scriptlog="${scriptlogdir}/${servicename}-script.log"
lgsmlog="${lgsmlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
emaillog="${scriptlogdir}/${servicename}-email.log"
emaillog="${lgsmlogdir}/${servicename}-email.log"
## Logs Naming
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

9
lgsm/config-default/config-lgsm/sdtdserver/_default.cfg

@ -77,14 +77,15 @@ servercfgfullpath="${servercfgdir}/${servercfg}"
backupdir="${lgsmdir}/backup"
## Logging Directories
logdir="${logdir}"
gamelogdir="${logdir}/server"
scriptlogdir="${logdir}/script"
lgsmlogdir="${logdir}/script"
consolelogdir="${logdir}/console"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
lgsmlog="${lgsmlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
emaillog="${scriptlogdir}/${servicename}-email.log"
emaillog="${lgsmlogdir}/${servicename}-email.log"
## Logs Naming
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

14
lgsm/functions/alert_email.sh

@ -173,15 +173,15 @@ fn_alert_email_template_logs(){
echo -e "${servicename} Logs"
echo -e "================================="
if [ -n "${scriptlog}" ]; then
if [ -n "${lgsmlog}" ]; then
echo -e "\nScript log\n==================="
if [ ! "$(ls -A ${scriptlogdir})" ]; then
echo "${scriptlogdir} (NO LOG FILES)"
elif [ ! -s "${scriptlog}" ]; then
echo "${scriptlog} (LOG FILE IS EMPTY)"
if [ ! "$(ls -A ${lgsmlogdir})" ]; then
echo "${lgsmlogdir} (NO LOG FILES)"
elif [ ! -s "${lgsmlog}" ]; then
echo "${lgsmlog} (LOG FILE IS EMPTY)"
else
echo "${scriptlog}"
tail -25 "${scriptlog}"
echo "${lgsmlog}"
tail -25 "${lgsmlog}"
fi
echo ""
fi

2
lgsm/functions/check_executable.sh

@ -10,7 +10,7 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
# Check if executable exists
if [ ! -f "${executabledir}/${execname}" ]; then
fn_script_log_warn "Executable was not found: ${executabledir}/${execname}"
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
fn_print_fail_nl "Executable was not found:"
echo " * ${executabledir}/${execname}"
fi

2
lgsm/functions/check_logs.sh

@ -16,7 +16,7 @@ fn_check_logs(){
}
# Create directories for the script and console logs
if [ ! -d "${scriptlogdir}" ]||[ ! -d "${consolelogdir}" ]&&[ "${gamename}" != "TeamSpeak 3" ]; then
if [ ! -d "${lgsmlogdir}" ]||[ ! -d "${consolelogdir}" ]&&[ "${gamename}" != "TeamSpeak 3" ]; then
fn_check_logs
fi

4
lgsm/functions/check_permissions.sh

@ -40,7 +40,7 @@ fn_check_ownership(){
find "${serverfiles}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n"
fi
} | column -s $'\t' -t | tee -a "${scriptlog}"
} | column -s $'\t' -t | tee -a "${lgsmlog}"
echo ""
fn_print_information_nl "please see https://github.com/GameServerManagers/LinuxGSM/wiki/FAQ#-fail--starting-game-server-ownership-issues-found"
fn_script_log "For more information, please see https://github.com/GameServerManagers/LinuxGSM/wiki/FAQ#-fail--starting-game-server-ownership-issues-found"
@ -62,7 +62,7 @@ fn_check_permissions(){
{
echo -e "File\n"
find "${functionsdir}" -type f -not -executable -printf "%p\n"
} | column -s $'\t' -t | tee -a "${scriptlog}"
} | column -s $'\t' -t | tee -a "${lgsmlog}"
if [ "${monitorflag}" == 1 ]; then
alert="permissions"
alert.sh

2
lgsm/functions/check_root.sh

@ -9,7 +9,7 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
if [ $(whoami) = "root" ]; then
fn_print_fail_nl "Do NOT run this script as root!"
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
fn_script_log_fatal "${selfname} attempted to run as root."
fi
core_exit.sh

4
lgsm/functions/check_steamcmd.sh

@ -20,14 +20,14 @@ fn_check_steamcmd_user(){
if [ "${steamuser}" == "username" ]; then
fn_print_fail_nl "Steam login not set. Update steamuser in ${selfname}"
echo " * Change steamuser=\"username\" to a valid steam login."
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
fn_script_log_fatal "Steam login not set. Update steamuser in ${selfname}"
fi
core_exit.sh
fi
# Anonymous user is set if steamuser is missing
if [ -z "${steamuser}" ]; then
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
fn_script_log_info "Using anonymous Steam login"
fi
steamuser="anonymous"

2
lgsm/functions/check_system_dir.sh

@ -15,7 +15,7 @@ fi
if [ ! -d "${checkdir}" ]; then
fn_print_fail_nl "Cannot access ${checkdir}: No such directory"
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
fn_script_log_fatal "Cannot access ${checkdir}: No such directory."
fi
core_exit.sh

4
lgsm/functions/command_backup.sh

@ -18,7 +18,7 @@ fn_backup_trap(){
fn_print_canceled_eol_nl
fn_script_log_info "Backup ${backupname}.tar.gz: CANCELED"
sleep 1
rm -f "${backupdir}/${backupname}.tar.gz" | tee -a "${scriptlog}"
rm -f "${backupdir}/${backupname}.tar.gz" | tee -a "${lgsmlog}"
echo -ne "backup ${backupname}.tar.gz..."
fn_print_removed_eol_nl
fn_script_log_info "Backup ${backupname}.tar.gz: REMOVED"
@ -118,7 +118,7 @@ fn_backup_compression(){
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol
fn_script_log_fatal "Backup in progress: FAIL"
echo "${tarcmd}" | tee -a "${scriptlog}"
echo "${tarcmd}" | tee -a "${lgsmlog}"
fn_print_fail_nl "Starting backup"
fn_script_log_fatal "Starting backup"
else

18
lgsm/functions/command_start.sh

@ -31,8 +31,8 @@ fn_start_teamspeak3(){
fn_script_log_error "${servername} is already running"
core_exit.sh
fi
if [ -f "${scriptlog}" ]; then
mv "${scriptlog}" "${scriptlogdate}"
if [ -f "${lgsmlog}" ]; then
mv "${lgsmlog}" "${lgsmlogdate}"
fi
# Create lockfile
date > "${rootdir}/${lockselfname}"
@ -79,7 +79,7 @@ fn_start_tmux(){
mv "${gamelog}" "${gamelogdate}"
fi
fi
mv "${scriptlog}" "${scriptlogdate}"
mv "${lgsmlog}" "${lgsmlogdate}"
mv "${consolelog}" "${consolelogdate}"
fi
@ -94,7 +94,7 @@ fn_start_tmux(){
# Create lockfile
date > "${rootdir}/${lockselfname}"
cd "${executabledir}"
tmux new-session -d -x "${sessionheight}" -y "${sessionwidth}" -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
tmux new-session -d -x "${sessionheight}" -y "${sessionwidth}" -s "${servicename}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${servicename}-tmux-error.tmp"
# tmux pipe-pane not supported in tmux versions < 1.6
if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ] 2>/dev/null; then # Tmux compiled from source will not return a number, therefore bypass this check and trash the error
@ -127,20 +127,20 @@ fn_start_tmux(){
fn_print_fail_nl "Unable to start ${servername}"
fn_script_log_fatal "Unable to start ${servername}"
sleep 1
if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
if [ -s "${lgsmlogdir}/.${servicename}-tmux-error.tmp" ]; then
fn_print_fail_nl "Unable to start ${servername}: Tmux error:"
fn_script_log_fatal "Unable to start ${servername}: Tmux error:"
echo ""
echo "Command"
echo "================================="
echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" | tee -a "${scriptlog}"
echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" | tee -a "${lgsmlog}"
echo ""
echo "Error"
echo "================================="
cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" | tee -a "${scriptlog}"
cat "${lgsmlogdir}/.${servicename}-tmux-error.tmp" | tee -a "${lgsmlog}"
# Detected error https://gameservermanagers.com/support
if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then
if [ $(grep -c "Operation not permitted" "${lgsmlogdir}/.${servicename}-tmux-error.tmp") ]; then
echo ""
echo "Fix"
echo "================================="
@ -172,7 +172,7 @@ fn_start_tmux(){
fn_print_ok "${servername}"
fn_script_log_pass "Started ${servername}"
fi
rm "${scriptlogdir}/.${servicename}-tmux-error.tmp"
rm "${lgsmlogdir}/.${servicename}-tmux-error.tmp"
echo -en "\n"
}

8
lgsm/functions/command_stop.sh

@ -161,10 +161,10 @@ fn_stop_graceful_sdtd(){
fn_print_error_nl "Graceful: telnet: Unknown error"
fn_script_log_error "Graceful: telnet: Unknown error"
fi
echo -en "\n" | tee -a "${scriptlog}"
echo -en "Telnet output:" | tee -a "${scriptlog}"
echo -en "\n ${sdtd_telnet_shutdown}" | tee -a "${scriptlog}"
echo -en "\n\n" | tee -a "${scriptlog}"
echo -en "\n" | tee -a "${lgsmlog}"
echo -en "Telnet output:" | tee -a "${lgsmlog}"
echo -en "\n ${sdtd_telnet_shutdown}" | tee -a "${lgsmlog}"
echo -en "\n\n" | tee -a "${lgsmlog}"
fi
else
fn_print_warn "Graceful: telnet: expect not installed: "

4
lgsm/functions/command_validate.sh

@ -27,9 +27,9 @@ fn_validation(){
fi
if [ "${engine}" == "goldsource" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}"
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit| tee -a "${lgsmlog}"
else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}"
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit| tee -a "${lgsmlog}"
fi
if [ $? != 0 ]; then
fn_print_fail_nl "Validating files: SteamCMD"

12
lgsm/functions/core_dl.sh

@ -69,7 +69,7 @@ fn_dl_extract(){
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Extracting download: FAIL"
echo "${extractcmd}" | tee -a "${scriptlog}"
echo "${extractcmd}" | tee -a "${lgsmlog}"
core_exit.sh
else
fn_print_ok_eol_nl
@ -84,7 +84,7 @@ fn_fetch_trap(){
fn_print_canceled_eol_nl
fn_script_log_info "Downloading ${local_filename}...CANCELED"
sleep 1
rm -f "${local_filedir}/${local_filename}" | tee -a "${scriptlog}"
rm -f "${local_filedir}/${local_filename}" | tee -a "${lgsmlog}"
echo -ne "downloading ${local_filename}..."
fn_print_removed_eol_nl
fn_script_log_info "Downloading ${local_filename}...REMOVED"
@ -120,15 +120,15 @@ fn_fetch_file(){
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
if [ -f "${scriptlog}" ]; then
if [ -f "${lgsmlog}" ]; then
fn_script_log_fatal "Downloading ${local_filename}: FAIL"
fi
echo -e "${remote_fileurl}" | tee -a "${scriptlog}"
echo "${curlcmd}" | tee -a "${scriptlog}"
echo -e "${remote_fileurl}" | tee -a "${lgsmlog}"
echo "${curlcmd}" | tee -a "${lgsmlog}"
core_exit.sh
else
fn_print_ok_eol_nl
if [ -f "${scriptlog}" ]; then
if [ -f "${lgsmlog}" ]; then
fn_script_log_pass "Downloading ${local_filename}: OK"
fi
fi

36
lgsm/functions/core_messages.sh

@ -27,22 +27,22 @@ fi
########################
## Feb 28 14:56:58 ut99-server: Monitor:
fn_script_log(){
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${lgsmlog}"
fi
fi
}
## Feb 28 14:56:58 ut99-server: Monitor: PASS:
fn_script_log_pass(){
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: PASS: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: PASS: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: PASS: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: PASS: ${1}" >> "${lgsmlog}"
fi
fi
exitcode=0
@ -50,11 +50,11 @@ fn_script_log_pass(){
## Feb 28 14:56:58 ut99-server: Monitor: FATAL:
fn_script_log_fatal(){
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: FATAL: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: FATAL: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: FATAL: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: FATAL: ${1}" >> "${lgsmlog}"
fi
fi
exitcode=1
@ -62,11 +62,11 @@ fn_script_log_fatal(){
## Feb 28 14:56:58 ut99-server: Monitor: ERROR:
fn_script_log_error(){
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: ERROR: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: ERROR: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ERROR: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ERROR: ${1}" >> "${lgsmlog}"
fi
fi
exitcode=2
@ -74,11 +74,11 @@ fn_script_log_error(){
## Feb 28 14:56:58 ut99-server: Monitor: WARN:
fn_script_log_warn(){
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: WARN: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: WARN: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: WARN: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: WARN: ${1}" >> "${lgsmlog}"
fi
fi
exitcode=3
@ -86,11 +86,11 @@ fn_script_log_warn(){
## Feb 28 14:56:58 ut99-server: Monitor: INFO:
fn_script_log_info(){
if [ -d "${scriptlogdir}" ]; then
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: INFO: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandname}: INFO: ${1}" >> "${lgsmlog}"
else
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: INFO: ${1}" >> "${scriptlog}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: INFO: ${1}" >> "${lgsmlog}"
fi
fi
}

14
lgsm/functions/fix_steamcmd.sh

@ -12,8 +12,8 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
fixname="steamclient.so general"
fn_fix_msg_start
mkdir -pv "${HOME}/.steam/sdk32" >> "${scriptlog}"
cp -v "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${scriptlog}"
mkdir -pv "${HOME}/.steam/sdk32" >> "${lgsmlog}"
cp -v "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}"
fn_fix_msg_end
fi
@ -22,8 +22,8 @@ if [ "${gamename}" == "Serious Sam 3: BFE" ]; then
if [ ! -f "${HOME}/.steam/bin32/libsteam.so" ]; then
fixname="libsteam.so"
fn_fix_msg_start
mkdir -pv "${HOME}/.steam/bin32" >> "${scriptlog}"
cp -v "${serverfiles}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" >> "${scriptlog}"
mkdir -pv "${HOME}/.steam/bin32" >> "${lgsmlog}"
cp -v "${serverfiles}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" >> "${lgsmlog}"
fn_fix_msg_end
fi
elif [ "${gamename}" == "Hurtworld" ]; then
@ -31,13 +31,13 @@ elif [ "${gamename}" == "Hurtworld" ]; then
if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then
fixname="steamclient.so x86"
fn_fix_msg_start
cp -v "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${scriptlog}"
cp -v "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}"
fn_fix_msg_end
fi
if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" ]; then
fixname="steamclient.so x86_64"
fn_fix_msg_start
cp -v "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${scriptlog}"
cp -v "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}"
fn_fix_msg_end
fi
elif [ "${gamename}" == "Tower Unite" ]; then
@ -45,7 +45,7 @@ elif [ "${gamename}" == "Tower Unite" ]; then
if [ ! -f "${executabledir}/steamclient.so" ]; then
fixname="steamclient.so"
fn_fix_msg_start
cp -v "${serverfiles}/linux64/steamclient.so" "${executabledir}/steamclient.so" >> "${scriptlog}"
cp -v "${serverfiles}/linux64/steamclient.so" "${executabledir}/steamclient.so" >> "${lgsmlog}"
fn_fix_msg_end
fi
fi

10
lgsm/functions/install_logs.sh

@ -14,16 +14,18 @@ if [ "${checklogs}" != "1" ]; then
echo "================================="
fi
sleep 1
# Create script and console log directories
# Create LinuxGSM logs
mkdir -pv "${logdir}"
mkdir -pv "${scriptlogdir}"
touch "${scriptlog}"
mkdir -pv "${lgsmlogdir}"
touch "${lgsmlog}"
# Create Console logs
if [ -n "${consolelogdir}" ]; then
mkdir -pv "${consolelogdir}"
touch "${consolelog}"
fi
# Create gamelogdir if variable exists but directory does not
# Create Game logs
if [ -n "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then
mkdir -pv "${gamelogdir}"
fi

36
lgsm/functions/logs.sh

@ -28,7 +28,7 @@ if [ "${status}" != "0" ] && [ "${function_selfname}" == "command_start.sh" ] &&
fi
# Log manager will start the cleanup if it finds logs older than "${logdays}"
if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
fn_print_dots "Starting"
# Set common logs directories
commonlogs="${systemdir}/logs"
@ -46,29 +46,29 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
fn_script_log_info "Removing logs older than "${logdays}" days"
# Logging logfiles to be removed according to "${logdays}", counting and removing them
# Script logfiles
find "${scriptlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${scriptlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
scriptcount=$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${lgsmlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
# SRCDS and unreal logfiles
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
find "${gamelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
find "${gamelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Console logfiles
if [ -n "${consolelog}" ]; then
find "${consolelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
find "${consolelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Common logfiles
if [ -d ${commonlogs} ]; then
find "${commonlogs}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
if [ -d "${commonlogs}" ]; then
find "${commonlogs}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
smcount=$(find "${commonlogs}"/ -type f -mtime +"${logdays}"|wc -l)
find "${commonlogs}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
if [ -d ${commonsourcelogs} ]; then
find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
smcount=$(find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"|wc -l)
find "${commonsourcelogs}"/* -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
@ -76,7 +76,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
if [ "${engine}" == "source" ]; then
# SourceMod logfiles
if [ -d "${sourcemodlogdir}" ]; then
find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
@ -84,28 +84,22 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
if [ "${gamename}" == "Garry's Mod" ]; then
# ULX logfiles
if [ -d "${ulxlogdir}" ]; then
find "${ulxlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
find "${ulxlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${ulxlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# DarkRP logfiles
if [ -d "${darkrplogdir}" ]; then
find "${darkrplogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
find "${darkrplogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${darkrplogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
fi
fi
# Legacy support
if [ -d "${legacyserverlogdir}" ]; then
find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
legacycount=$(find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
find "${legacyserverlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Count total amount of files removed
count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount} + ${legacycount}))
countlogs=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount}))
# Job done
fn_print_ok_nl "Removed ${count} log files"
fn_script_log "Removed ${count} log files"
fn_print_ok_nl "Removed ${countlogs} log files"
fn_script_log "Removed ${countlogs} log files"
fi

6
lgsm/functions/update_steamcmd.sh

@ -27,11 +27,11 @@ fn_update_steamcmd_dl(){
cd "${steamcmddir}"
if [ "${engine}" == "goldsource" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +quit | tee -a "${scriptlog}"
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +quit | tee -a "${lgsmlog}"
else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit | tee -a "${scriptlog}"
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit | tee -a "${lgsmlog}"
if [ "${gamename}" == "Classic Offensive" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid_co}" ${branch} +quit | tee -a "${scriptlog}"
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid_co}" ${branch} +quit | tee -a "${lgsmlog}"
fi
fi

6
linuxgsm.sh

@ -81,9 +81,9 @@ fn_bootstrap_fetch_file(){
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
if [ -f "${scriptlog}" ]; then
echo -e "${remote_fileurl}" | tee -a "${scriptlog}"
echo "${curlcmd}" | tee -a "${scriptlog}"
if [ -f "${lgsmlog}" ]; then
echo -e "${remote_fileurl}" | tee -a "${lgsmlog}"
echo "${curlcmd}" | tee -a "${lgsmlog}"
fi
exit 1
else

8
tests/tests_jc2server.sh

@ -106,14 +106,14 @@ backupdir="${rootdir}/backups"
## Logging Directories
#gamelogdir="" # No server logs available
scriptlogdir="${rootdir}/log/script"
lgsmlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
scriptlog="${scriptlogdir}/${servicename}-script.log"
lgsmlog="${lgsmlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
emaillog="${scriptlogdir}/${servicename}-email.log"
emaillog="${lgsmlogdir}/${servicename}-email.log"
## Logs Naming
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
########################

8
tests/tests_ts3server.sh

@ -93,12 +93,12 @@ backupdir="${rootdir}/backups"
## Logging Directories
gamelogdir="${serverfiles}/logs"
scriptlogdir="${rootdir}/log/script"
scriptlog="${scriptlogdir}/${servicename}-script.log"
emaillog="${scriptlogdir}/${servicename}-email.log"
lgsmlogdir="${rootdir}/log/script"
lgsmlog="${lgsmlogdir}/${servicename}-script.log"
emaillog="${lgsmlogdir}/${servicename}-email.log"
## Logs Naming
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
########################
######## Script ########

Loading…
Cancel
Save