From 9e856b9d90b6e54eb37c5140ab994cbf67805b95 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 7 Feb 2016 22:20:30 +0000 Subject: [PATCH 01/20] Added GSLT for blackmesa --- BlackMesa/bmdmserver | 7 ++++++- BrainBread2/bb2server | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/BlackMesa/bmdmserver b/BlackMesa/bmdmserver index 7601f826a..d31b067fc 100644 --- a/BlackMesa/bmdmserver +++ b/BlackMesa/bmdmserver @@ -31,9 +31,14 @@ clientport="27005" ip="0.0.0.0" updateonstart="off" +# Optional: Game Server Login Token +# GSLT can be used for running a public server. +# More info: http://gameservermanagers.com/gslt +gslt="" + # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server fn_parms(){ -parms="-game bms -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +parms="-game bms -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" } #### Advanced Variables #### diff --git a/BrainBread2/bb2server b/BrainBread2/bb2server index a78fdbc5a..df17a46f9 100644 --- a/BrainBread2/bb2server +++ b/BrainBread2/bb2server @@ -31,8 +31,8 @@ clientport="27005" ip="0.0.0.0" updateonstart="off" -# Required: Game Server Login Token -# GSLT is required for running a public server. +# Optional: Game Server Login Token +# GSLT can be used for running a public server. # More info: http://gameservermanagers.com/gslt gslt="" From 61b5aacc74b50fef4321e3fd32515f983503bd1f Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 11:37:03 +0100 Subject: [PATCH 02/20] Added variables for additional logs --- functions/logs.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/functions/logs.sh b/functions/logs.sh index ecca143c0..317af4255 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -2,17 +2,31 @@ # LGSM logs.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="271215" +lgsm_version="100215" # Description: Acts as a log rotater, removing old logs. local modulename="Log Manager" +# Check if logfile variable and file exist, create logfile if it doesn't exist if [ -n "${consolelog}" ]; then if [ ! -e "${consolelog}" ]; then touch "${consolelog}" fi fi + +# Set source log directory +if [ -z "${systemdir}" && "${engine}" == "source" ]; then + srcdslogdir="${systemdir}/logs" + # Set addons directories + sourcemodlogdir="${systemdir}/addons/sourcemod/logs" + # Set gmod addons directories + if [ "${gamename}" == "Garry's Mod" ]; then + ulxlogdir="${systemdir}/data/ulx_logs" + darkrplogdir="${systemdir}/data/darkrp_logs" + fi +fi + # log manager will active if finds logs older than ${logdays} if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fn_printdots "Starting" From 1bb6844da4fbea769abb6f8afa66c12af4fc37fc Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 12:55:07 +0100 Subject: [PATCH 03/20] Added comments --- functions/logs.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 317af4255..68b66989b 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -39,24 +39,32 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fn_scriptlog "Removing logs older than ${logdays} days" sleep 1 echo -en "\n" + # Retrocompatibility, for logs directly in /log folder + # Find game logfiles older than ${logdays} and write that list to the current script log if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" fi + # Find script logfiles older than ${logdays} and write that list to the current script log find "${scriptlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + # Find console logfiles older than ${logdays} and write that list to the current script log if [ -n "${consolelog}" ]; then find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" fi + # Retrocompatibility, for logs directly in /log folder + # Count how many script logfiles will be removed if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then gamecount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) fi + # Count how many script logfiles will be removed scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) echo "${consolelog}" + # Count how many console logfiles will be removed if [ -n "${consolelog}" ]; then consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) else consolecount=0 fi - + # Count total amount of files to remove count=$((${scriptcount} + ${consolecount})) if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then count=$((${scriptcount} + ${consolecount} + ${gamecount})) @@ -64,7 +72,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then count=$((${scriptcount} + ${consolecount})) fi - + # Removing logfiles if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi From f25bc42f6373f8b66711b97cafc8a4cdaacf5798 Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 13:00:14 +0100 Subject: [PATCH 04/20] Fix gamecount targetting wrong folder Gamecount should target gamelogdir, not scriptlogdir, as it seems to be for retrocompatibility only, and according to this (line 44) : if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" fi --- functions/logs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/logs.sh b/functions/logs.sh index 68b66989b..885fe7722 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -53,7 +53,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then # Retrocompatibility, for logs directly in /log folder # Count how many script logfiles will be removed if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then - gamecount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) + gamecount=$(find "${gamelogdir}"/ -type f -mtime +${logdays}|wc -l) fi # Count how many script logfiles will be removed scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) From eb67a375ad9100162643dc9b9a175548957be7df Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 13:11:51 +0100 Subject: [PATCH 05/20] Simplifying counting Why make it simple when you can make it harder ! > Removing conditional functions for additions, by setting all variables to 0 before starting counting. > Removing "else, set to 0", as 0 is now the default state --- functions/logs.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 885fe7722..75ad64347 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -50,6 +50,9 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then if [ -n "${consolelog}" ]; then find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" fi + # Counting + # Setting up variables + scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" # Retrocompatibility, for logs directly in /log folder # Count how many script logfiles will be removed if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then @@ -58,19 +61,12 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then # Count how many script logfiles will be removed scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) echo "${consolelog}" - # Count how many console logfiles will be removed + # Count how many console logfiles will be removed, if those logs exist if [ -n "${consolelog}" ]; then consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) - else - consolecount=0 fi # Count total amount of files to remove - count=$((${scriptcount} + ${consolecount})) - if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then - count=$((${scriptcount} + ${consolecount} + ${gamecount})) - else - count=$((${scriptcount} + ${consolecount})) - fi + count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) # Removing logfiles if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then From f91b736ec7d4970aef6a8e83b0831b30aa0c30d0 Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 14:10:10 +0100 Subject: [PATCH 06/20] Merging all in one, adding new logs support Merging logging, counting, and removing logfiles in one place, to avoid some redundant if statements Also, understanding the code and supporting new logs should be easier. Adding srcds / sm / ulx / darkrp logs support --- functions/logs.sh | 74 ++++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 75ad64347..9833b7db0 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -15,7 +15,7 @@ if [ -n "${consolelog}" ]; then fi fi -# Set source log directory +# Set source logs directories if [ -z "${systemdir}" && "${engine}" == "source" ]; then srcdslogdir="${systemdir}/logs" # Set addons directories @@ -27,7 +27,10 @@ if [ -z "${systemdir}" && "${engine}" == "source" ]; then fi fi -# log manager will active if finds logs older than ${logdays} +# Setting up counting variables +scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" + +# 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 fn_printdots "Starting" sleep 1 @@ -39,43 +42,54 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fn_scriptlog "Removing logs older than ${logdays} days" sleep 1 echo -en "\n" - # Retrocompatibility, for logs directly in /log folder - # Find game logfiles older than ${logdays} and write that list to the current script log - if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then - find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - fi - # Find script logfiles older than ${logdays} and write that list to the current script log + # Logging logfiles to be removed according to ${logdays}, counting and removing them + # Script logfiles find "${scriptlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - # Find console logfiles older than ${logdays} and write that list to the current script log - if [ -n "${consolelog}" ]; then - find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - fi - # Counting - # Setting up variables - scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" + scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${scriptlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; # Retrocompatibility, for logs directly in /log folder - # Count how many script logfiles will be removed if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then + find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" gamecount=$(find "${gamelogdir}"/ -type f -mtime +${logdays}|wc -l) - fi - # Count how many script logfiles will be removed - scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) - echo "${consolelog}" - # Count how many console logfiles will be removed, if those logs exist - if [ -n "${consolelog}" ]; then - consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) - fi - # Count total amount of files to remove - count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) - - # Removing logfiles - if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi - find "${scriptlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + # Console logfiles if [ -n "${consolelog}" ]; then + find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) find "${consolelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi + # SRCDS logfiles + if [ "${engine}" == "source" ]; then + if [ -d "${srcdslogdir}" ]; then + find "${srcdslogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + srcdscount=$(find "${srcdslogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${srcdslogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + fi + # SourceMod logfiles + if [ -d "${sourcemodlogdir}" ]; then + find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${sourcemodlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + fi + # ULX logfiles + if [ "${gamename}" == "Garry's Mod" ] + if [ -d "${ulxlogdir}" ]; then + find "${ulxlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${ulxlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + fi + if [ -d "${darkrplogdir}" ]; then + find "${darkrplogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${darkrplogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + fi + fi + fi + + # Count total amount of files removed + count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) + # Job done fn_printok "Removed ${count} log files" fn_scriptlog "Removed ${count} log files" sleep 1 From 65d58f6d7d1ed6c965c14989a99deb853f0a301f Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 14:48:43 +0100 Subject: [PATCH 07/20] correcting syntax --- functions/logs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 9833b7db0..d295fd72f 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -16,7 +16,7 @@ if [ -n "${consolelog}" ]; then fi # Set source logs directories -if [ -z "${systemdir}" && "${engine}" == "source" ]; then +if [ -z "${systemdir}" ]&&[ "${engine}" == "source" ]; then srcdslogdir="${systemdir}/logs" # Set addons directories sourcemodlogdir="${systemdir}/addons/sourcemod/logs" @@ -73,7 +73,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then find "${sourcemodlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi # ULX logfiles - if [ "${gamename}" == "Garry's Mod" ] + if [ "${gamename}" == "Garry's Mod" ]; then if [ -d "${ulxlogdir}" ]; then find "${ulxlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +${logdays}|wc -l) From 37f4acbf90f382e39bd3971c3bf1b13796055e5a Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 15:06:06 +0100 Subject: [PATCH 08/20] Removing double SRCDS, improving comments and removing useless check for creating folders variables --- functions/logs.sh | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index d295fd72f..680f3ecc0 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -15,17 +15,10 @@ if [ -n "${consolelog}" ]; then fi fi -# Set source logs directories -if [ -z "${systemdir}" ]&&[ "${engine}" == "source" ]; then - srcdslogdir="${systemdir}/logs" - # Set addons directories - sourcemodlogdir="${systemdir}/addons/sourcemod/logs" - # Set gmod addons directories - if [ "${gamename}" == "Garry's Mod" ]; then - ulxlogdir="${systemdir}/data/ulx_logs" - darkrplogdir="${systemdir}/data/darkrp_logs" - fi -fi +# Set addon logs directories +sourcemodlogdir="${systemdir}/addons/sourcemod/logs" +ulxlogdir="${systemdir}/data/ulx_logs" +darkrplogdir="${systemdir}/data/darkrp_logs" # Setting up counting variables scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" @@ -47,7 +40,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then 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 {} \; - # Retrocompatibility, for logs directly in /log folder + # SRCDS and unreal logfiles if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" gamecount=$(find "${gamelogdir}"/ -type f -mtime +${logdays}|wc -l) @@ -59,26 +52,23 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) find "${consolelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi - # SRCDS logfiles + # Source addons logfiles if [ "${engine}" == "source" ]; then - if [ -d "${srcdslogdir}" ]; then - find "${srcdslogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - srcdscount=$(find "${srcdslogdir}"/ -type f -mtime +${logdays}|wc -l) - find "${srcdslogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; - fi # SourceMod logfiles if [ -d "${sourcemodlogdir}" ]; then find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|wc -l) find "${sourcemodlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi - # ULX logfiles + # Garry's Mod logfiles if [ "${gamename}" == "Garry's Mod" ]; then + # ULX logfiles if [ -d "${ulxlogdir}" ]; then find "${ulxlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" 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}" darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +${logdays}|wc -l) @@ -86,7 +76,6 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fi fi fi - # Count total amount of files removed count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) # Job done From bb552e1d0747576dbb3801699c087145e997a049 Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 15:14:49 +0100 Subject: [PATCH 09/20] Moving variable initialization inside if function --- functions/logs.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 680f3ecc0..8e04d5a15 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -15,17 +15,15 @@ if [ -n "${consolelog}" ]; then fi fi -# Set addon logs directories -sourcemodlogdir="${systemdir}/addons/sourcemod/logs" -ulxlogdir="${systemdir}/data/ulx_logs" -darkrplogdir="${systemdir}/data/darkrp_logs" - -# Setting up counting variables -scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" - # 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 fn_printdots "Starting" + # Set addon logs directories + sourcemodlogdir="${systemdir}/addons/sourcemod/logs" + ulxlogdir="${systemdir}/data/ulx_logs" + darkrplogdir="${systemdir}/data/darkrp_logs" + # Setting up counting variables + scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" sleep 1 fn_printok "Starting" fn_scriptlog "Starting" From c7f26352e92156502711c0ff343e5d82243529d7 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 10 Feb 2016 14:28:56 +0000 Subject: [PATCH 10/20] Adding Codename CURE --- CodenameCURE/cfg/lgsm-default.cfg | 101 ++++++++++++++++++++++ CodenameCURE/cssserver | 138 ++++++++++++++++++++++++++++++ functions/install_config.sh | 6 ++ 3 files changed, 245 insertions(+) create mode 100644 CodenameCURE/cfg/lgsm-default.cfg create mode 100644 CodenameCURE/cssserver diff --git a/CodenameCURE/cfg/lgsm-default.cfg b/CodenameCURE/cfg/lgsm-default.cfg new file mode 100644 index 000000000..e4cce5e6f --- /dev/null +++ b/CodenameCURE/cfg/lgsm-default.cfg @@ -0,0 +1,101 @@ +// **************************************************************************** +// * +// CodenameCURE - server.cfg * +// Version 100216 * +// * +// **************************************************************************** + +// ............................. Basic Settings ............................. // + +// Hostname for server. +hostname "" + +// RCON - remote console password. +rcon_password "" + +// Server password - for private servers. +sv_password "" + +// Contact email for server sysop. +sv_contact "email@example.com" + +// LAN Mode - If set the server will not show on the internet. +// Default: sv_lan 0 +sv_lan 0 + +// ............................... Map Cycles ............................... // +// info: There are several predefined mapcycles available that are listed below. +// You can also create your own custom mapcycle. + +// "mapcycle.txt" - all maps +// "mapcycle_objective.txt" - objective maps only +// "mapcycle_survival.txt" - survival maps only +// +mapcyclefile "mapcycle.txt" + +// ........................ Game Specific Commands ........................ // +// info: any commands that only apply to this game. + +// Difficulty +// 0 - Easy +// 1 - Average +// 2 - Skilled +// 3 - Insane +sv_difficulty "1" + +// ............................. Communication ............................. // + +// Enable communication over voice via microphone. +// Default: sv_voiceenable 1 +sv_voiceenable 1 + +// Players can hear all other players, no team restrictions. +// Default: sv_alltalk 0 +sv_alltalk 1 + +// ............................. Fast Download .............................. // +// info: Allows custom maps to be downloaded to the client. + +// Allows clients to download custom maps and textures etc. from the server at 20 kbps. +// Default: sv_allowdownload 1 +sv_allowdownload 1 + +// Allows clients to download custom maps, textures etc. from a web server with no transfer limit. +// Example: +// server location: maps/custommap.bsp +// web server location: http://example.com/custom/maps/custommap.bsp +// sv_downloadurl "http://example.com/custom" +// Default: sv_downloadurl "" +sv_downloadurl "" + +// ................................ Ban List ............................... // + +// personal banlist based on user IDs. +exec banned_user.cfg + +// personal banlist based on user IPs. +exec banned_ip.cfg + +writeid +writeip + +// ............................. Server Logging ............................. // + +//Enables logging to file, console, and udp < on | off >. +log on + +// Log server bans in the server logs. +// Default: sv_logbans 1 +sv_logbans 1 + +// Echo log information to the console. +// Default: sv_logecho 1 +sv_logecho 1 + +// Log server information in the log file. +// Default: sv_logfile 1 +sv_logfile 1 + +// Log server information to only one file. +// Default: sv_log_onefile 0 +sv_log_onefile 0 diff --git a/CodenameCURE/cssserver b/CodenameCURE/cssserver new file mode 100644 index 000000000..e55ea14bd --- /dev/null +++ b/CodenameCURE/cssserver @@ -0,0 +1,138 @@ +#!/bin/bash +# Codename CURE +# Server Management Script +# Author: Daniel Gibbs +# Website: http://gameservermanagers.com +if [ -f ".dev-debug" ]; then + exec 5>dev-debug.log + BASH_XTRACEFD="5" + set -x +fi + +version="271215" + +#### Variables #### + +# Notification Email +# (on|off) +emailnotification="off" +email="email@example.com" + +# Steam login +steamuser="anonymous" +steampass="" + +# Start Variables +defaultmap="cbe_bunker" +maxplayers="6" +port="27015" +sourcetvport="27058" +clientport="27005" +ip="0.0.0.0" +updateonstart="off" + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game cure -insecure -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} + +#### Advanced Variables #### + +# Github Branch Select +# Allows for the use of different function files +# from a different repo and/or branch. +githubuser="dgibbs64" +githubrepo="linuxgsm" +githubbranch="master" + +# Steam +appid="383410" + +# Server Details +servicename="cc-server" +gamename="Codename Cure" +engine="source" + +# Directories +rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" +selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" +lockselfname=".${servicename}.lock" +filesdir="${rootdir}/serverfiles" +systemdir="${filesdir}/cure" +executabledir="${filesdir}" +executable="./srcds_run" +servercfg="${servicename}.cfg" +servercfgdir="${systemdir}/cfg" +servercfgfullpath="${servercfgdir}/${servercfg}" +servercfgdefault="${servercfgdir}/lgsm-default.cfg" +backupdir="${rootdir}/backups" + +# Logging +logdays="7" +gamelogdir="${systemdir}/logs" +scriptlogdir="${rootdir}/log/script" +consolelogdir="${rootdir}/log/console" + +scriptlog="${scriptlogdir}/${servicename}-script.log" +consolelog="${consolelogdir}/${servicename}-console.log" +emaillog="${scriptlogdir}/${servicename}-email.log" + +scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log" +consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log" + +##### Script ##### +# Do not edit + +fn_getgithubfile(){ +filename=$1 +exec=$2 +fileurl=${3:-$filename} +filepath="${rootdir}/${filename}" +filedir=$(dirname "${filepath}") +# If the function file is missing, then download +if [ ! -f "${filepath}" ]; then + if [ ! -d "${filedir}" ]; then + mkdir "${filedir}" + fi + githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}" + echo -e " fetching ${filename}...\c" + if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then + : + else + echo -e "\e[0;31mFAIL\e[0m\n" + echo "Curl is not installed!" + echo -e "" + exit + fi + curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1) + if [ $? -ne 0 ]; then + echo -e "\e[0;31mFAIL\e[0m\n" + echo "${curl}" + echo -e "${githuburl}\n" + exit + else + echo -e "\e[0;32mOK\e[0m" + fi + if [ "${exec}" ]; then + chmod +x "${filepath}" + fi +fi +if [ "${exec}" ]; then + source "${filepath}" +fi +} + +fn_runfunction(){ + fn_getgithubfile "functions/${functionfile}" 1 +} + +core_functions.sh(){ +# Functions are defined in core_functions.sh. +functionfile="${FUNCNAME}" +fn_runfunction +} + +core_functions.sh + +getopt=$1 +core_getopt.sh diff --git a/functions/install_config.sh b/functions/install_config.sh index f3420e9ac..4cd6948b5 100644 --- a/functions/install_config.sh +++ b/functions/install_config.sh @@ -180,6 +180,12 @@ elif [ "${gamename}" == "Blade Symphony" ]; then wget -N /dev/null ${githuburl}/BladeSymphony/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq sleep 1 fn_goldsourceconfig +elif [ "${gamename}" == "Codename CURE" ]; then + echo -e "downloading lgsm-default.cfg...\c" + wget -N /dev/null ${githuburl}/Codename CURE/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq + sleep 1 + fn_sourceconfig + elif [ "${gamename}" == "Counter Strike 1.6" ]; then echo -e "downloading lgsm-default.cfg...\c" wget -N /dev/null ${githuburl}/CounterStrike/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq From 80b54428c9de0449271a73cfec816e5fb2bc64a2 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 10 Feb 2016 14:31:20 +0000 Subject: [PATCH 11/20] Corrected name --- CodenameCURE/cssserver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CodenameCURE/cssserver b/CodenameCURE/cssserver index e55ea14bd..d903e57c9 100644 --- a/CodenameCURE/cssserver +++ b/CodenameCURE/cssserver @@ -50,7 +50,7 @@ appid="383410" # Server Details servicename="cc-server" -gamename="Codename Cure" +gamename="Codename CURE" engine="source" # Directories From ff0e8a013e8ca58d4dc508cff6532729cfa5c0c5 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 10 Feb 2016 14:33:11 +0000 Subject: [PATCH 12/20] corrected URL --- functions/install_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/install_config.sh b/functions/install_config.sh index 4cd6948b5..913bf26f0 100644 --- a/functions/install_config.sh +++ b/functions/install_config.sh @@ -182,7 +182,7 @@ elif [ "${gamename}" == "Blade Symphony" ]; then fn_goldsourceconfig elif [ "${gamename}" == "Codename CURE" ]; then echo -e "downloading lgsm-default.cfg...\c" - wget -N /dev/null ${githuburl}/Codename CURE/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq + wget -N /dev/null ${githuburl}/CodenameCURE/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq sleep 1 fn_sourceconfig From 1efb5db26a57a03b2a2a41d3f102d6e8583d85b1 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 10 Feb 2016 14:38:26 +0000 Subject: [PATCH 13/20] ports --- CodenameCURE/cssserver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CodenameCURE/cssserver b/CodenameCURE/cssserver index d903e57c9..a80d57b2d 100644 --- a/CodenameCURE/cssserver +++ b/CodenameCURE/cssserver @@ -26,7 +26,7 @@ steampass="" defaultmap="cbe_bunker" maxplayers="6" port="27015" -sourcetvport="27058" +sourcetvport="27020" clientport="27005" ip="0.0.0.0" updateonstart="off" From afff99e3fce0cf6639ebfc45f6ee791046966588 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 10 Feb 2016 14:45:52 +0000 Subject: [PATCH 14/20] Updated config --- CodenameCURE/cfg/lgsm-default.cfg | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CodenameCURE/cfg/lgsm-default.cfg b/CodenameCURE/cfg/lgsm-default.cfg index e4cce5e6f..296c28ec8 100644 --- a/CodenameCURE/cfg/lgsm-default.cfg +++ b/CodenameCURE/cfg/lgsm-default.cfg @@ -28,9 +28,6 @@ sv_lan 0 // You can also create your own custom mapcycle. // "mapcycle.txt" - all maps -// "mapcycle_objective.txt" - objective maps only -// "mapcycle_survival.txt" - survival maps only -// mapcyclefile "mapcycle.txt" // ........................ Game Specific Commands ........................ // @@ -43,6 +40,13 @@ mapcyclefile "mapcycle.txt" // 3 - Insane sv_difficulty "1" +// Server tags - Tags show up on the in-game server browser. This helps +// users filter servers. +// vanilla - he server runs the default settings. +// custom - the server runs custom gameplay settings or mods. +// example: sv_tags "custom, fastdl" +sv_tags "" + // ............................. Communication ............................. // // Enable communication over voice via microphone. From 2bde7897a7222add099f9294033c63cd9964de0a Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 15:54:06 +0100 Subject: [PATCH 15/20] Adding legacy server log dir support --- functions/logs.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 8e04d5a15..8b8952a0d 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -22,8 +22,9 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then sourcemodlogdir="${systemdir}/addons/sourcemod/logs" ulxlogdir="${systemdir}/data/ulx_logs" darkrplogdir="${systemdir}/data/darkrp_logs" + legacyserverlogdir="${rootdir}/log/server" # Setting up counting variables - scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" + scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0" sleep 1 fn_printok "Starting" fn_scriptlog "Starting" @@ -74,8 +75,19 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then 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 {} \; + # Remove folder if empty + if [ ! "$(ls -A "${legacyserverlogdir}"" ]; then + rm -rf "${legacyserverlogdir}" + fi + fi + # Count total amount of files removed - count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) + count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount} + ${legacycount})) # Job done fn_printok "Removed ${count} log files" fn_scriptlog "Removed ${count} log files" From 443018125af355edc86d4d6239f8916d853eb207 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 10 Feb 2016 15:07:38 +0000 Subject: [PATCH 16/20] missing then --- functions/command_dev_detect_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command_dev_detect_deps.sh b/functions/command_dev_detect_deps.sh index f6d1da766..06bf99599 100644 --- a/functions/command_dev_detect_deps.sh +++ b/functions/command_dev_detect_deps.sh @@ -37,7 +37,7 @@ fi if [ "$(command -v eu-readelf)" ]; then readelf=eu-readelf -elif [ "$(command -v readelf)" ]; +elif [ "$(command -v readelf)" ]; then readelf=readelf else echo "readelf/eu-readelf not installed" From 6b9ae31587f6b3c7459fbcef6a88ce338105f0d7 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 10 Feb 2016 15:23:17 +0000 Subject: [PATCH 17/20] renamed server --- CodenameCURE/{cssserver => ccserver} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CodenameCURE/{cssserver => ccserver} (100%) diff --git a/CodenameCURE/cssserver b/CodenameCURE/ccserver similarity index 100% rename from CodenameCURE/cssserver rename to CodenameCURE/ccserver From 9a2bbfd572146718bced4b652878e2f424821c74 Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 16:23:44 +0100 Subject: [PATCH 18/20] Closing parenthesis, works better. --- functions/logs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/logs.sh b/functions/logs.sh index 8b8952a0d..86b366848 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -81,7 +81,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then legacycount=$(find "${legacyserverlogdir}"/ -type f -mtime +${logdays}|wc -l) find "${legacyserverlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; # Remove folder if empty - if [ ! "$(ls -A "${legacyserverlogdir}"" ]; then + if [ ! "$(ls -A "${legacyserverlogdir}")" ]; then rm -rf "${legacyserverlogdir}" fi fi From fce7a6a957deb9a66237e838cc824d180a16f03d Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 16:28:24 +0100 Subject: [PATCH 19/20] Added myself as a contributor :) --- functions/logs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/logs.sh b/functions/logs.sh index 86b366848..83c80437d 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -1,6 +1,7 @@ #!/bin/bash # LGSM logs.sh function # Author: Daniel Gibbs +# Contributor: UltimateByte # Website: http://gameservermanagers.com lgsm_version="100215" From 74b26af7d35bb4a5b86d3acec81198bb47e6cc78 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 10 Feb 2016 15:55:50 +0000 Subject: [PATCH 20/20] Double quote to prevent globbing and word splitting. https://github.com/koalaman/shellcheck/wiki/SC2086 --- functions/logs.sh | 52 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 83c80437d..a294c4d35 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -16,8 +16,8 @@ if [ -n "${consolelog}" ]; then fi 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 +# 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 fn_printdots "Starting" # Set addon logs directories sourcemodlogdir="${systemdir}/addons/sourcemod/logs" @@ -31,56 +31,56 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fn_scriptlog "Starting" sleep 1 echo -en "\n" - fn_printinfo "Removing logs older than ${logdays} days" - fn_scriptlog "Removing logs older than ${logdays} days" + fn_printinfo "Removing logs older than "${logdays}" days" + fn_scriptlog "Removing logs older than "${logdays}" days" sleep 1 echo -en "\n" - # Logging logfiles to be removed according to ${logdays}, counting and removing them + # 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 "${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 {} \; # SRCDS and unreal logfiles if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then - find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - gamecount=$(find "${gamelogdir}"/ -type f -mtime +${logdays}|wc -l) - find "${gamelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + find "${gamelogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}" + 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}" - consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) - find "${consolelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + find "${consolelogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}" + consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}"|wc -l) + find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; fi # Source addons logfiles if [ "${engine}" == "source" ]; then # SourceMod logfiles if [ -d "${sourcemodlogdir}" ]; then - find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|wc -l) - find "${sourcemodlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}" + smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|wc -l) + find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; fi # Garry's Mod logfiles if [ "${gamename}" == "Garry's Mod" ]; then # ULX logfiles if [ -d "${ulxlogdir}" ]; then - find "${ulxlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +${logdays}|wc -l) - find "${ulxlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}" + 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}" - darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +${logdays}|wc -l) - find "${darkrplogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}" + 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 {} \; + 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 {} \; # Remove folder if empty if [ ! "$(ls -A "${legacyserverlogdir}")" ]; then rm -rf "${legacyserverlogdir}"