From 8d46a49a016fba76b90e15420e9361a5226bed87 Mon Sep 17 00:00:00 2001 From: Poil Date: Sun, 25 Jan 2015 21:24:07 +0100 Subject: [PATCH 1/7] Fix : binary operator expected and don't use a not not operator --- functions/fn_messages | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/functions/fn_messages b/functions/fn_messages index a4c618c2e..6d35314bd 100644 --- a/functions/fn_messages +++ b/functions/fn_messages @@ -8,7 +8,7 @@ # Date and servicename for log files. fn_scriptlog(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: ${1}" >> "${scriptlog}" else echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${scriptlog}" @@ -17,7 +17,7 @@ fn_scriptlog(){ # [ FAIL ] fn_printfail(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[\e[0;31m FAIL \e[0m] $@" @@ -25,7 +25,7 @@ fn_printfail(){ } fn_printfailnl(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" else echo -e "\r\033[K[\e[0;31m FAIL \e[0m] $@" @@ -34,7 +34,7 @@ fn_printfailnl(){ # [ OK ] fn_printok(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[\e[0;32m OK \e[0m] $@" @@ -42,7 +42,7 @@ fn_printok(){ } fn_printoknl(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" else echo -e "\r\033[K[\e[0;32m OK \e[0m] $@" @@ -51,7 +51,7 @@ fn_printoknl(){ # [ INFO ] fn_printinfo(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[\e[0;36m INFO \e[0m] $@" @@ -59,7 +59,7 @@ fn_printinfo(){ } fn_printinfonl(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" else echo -e "\r\033[K[\e[0;36m INFO \e[0m] $@" @@ -68,7 +68,7 @@ fn_printinfonl(){ # [ WARN ] fn_printwarn(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[\e[1;33m WARN \e[0m] $@" @@ -76,7 +76,7 @@ fn_printwarn(){ } fn_printwarnnl(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -e "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" else echo -e "\r\033[K[\e[1;33m WARN \e[0m] $@" @@ -85,7 +85,7 @@ fn_printwarnnl(){ # [ .... ] fn_printdots(){ - if [ ! -z ${modulename} ]; then + if [[ -n ${modulename} ]]; then echo -en "\r\033[K[ .... ] ${modulename} ${servicename}: $@" else echo -en "\r\033[K[ .... ] $@" @@ -126,4 +126,4 @@ fn_printerror(){ fn_printerrornl(){ echo -e "\e[0;31mError!\e[0m $@" -} \ No newline at end of file +} From 7df2d8c602a01470769596f46c8487c999462467 Mon Sep 17 00:00:00 2001 From: Poil Date: Sun, 25 Jan 2015 21:37:43 +0100 Subject: [PATCH 2/7] True selfname. Remove stupid code --- 7DaysToDie/sdtdserver | 6 +++--- Arma3/arma3server | 6 +++--- BladeSymphony/bsserver | 6 +++--- CounterStrike/csserver | 4 ++-- CounterStrikeGlobalOffensive/csgoserver | 6 +++--- CounterStrikeSource/cssserver | 6 +++--- DayOfDefeat/dodserver | 6 +++--- DayOfDefeatSource/dodsserver | 6 +++--- FistfulOfFrags/fofserver | 6 +++--- GarrysMod/gmodserver | 6 +++--- HalfLife2Deathmatch/hl2dmserver | 6 +++--- HalfLifeDeathmatchClassic/hldmcserver | 6 +++--- Insurgency/insserver | 6 +++--- JustCause2/jc2server | 6 +++--- KillingFloor/kfserver | 6 +++--- Left4Dead/l4dserver | 6 +++--- Left4Dead2/l4d2server | 6 +++--- Mumble/mumbleserver | 6 +++--- NaturalSelection2/ns2server | 6 +++--- NoMoreRoomInHell/nmrihserver | 6 +++--- RedOrchestra/roserver | 6 +++--- SeriousSam3BFE/ss3sserver | 6 +++--- TeamFortress2/tf2server | 6 +++--- TeamFortressClassic/tfcserver | 6 +++--- TheHiddenSource/thsserver | 4 ++-- UnrealTournament2004/ut2k4server | 6 +++--- UnrealTournament99/ut99server | 6 +++--- 27 files changed, 79 insertions(+), 79 deletions(-) diff --git a/7DaysToDie/sdtdserver b/7DaysToDie/sdtdserver index 7623498fd..87f19dd65 100644 --- a/7DaysToDie/sdtdserver +++ b/7DaysToDie/sdtdserver @@ -40,8 +40,8 @@ engine="unity3d" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" @@ -94,4 +94,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/Arma3/arma3server b/Arma3/arma3server index e8503b902..f1a190eb3 100644 --- a/Arma3/arma3server +++ b/Arma3/arma3server @@ -36,8 +36,8 @@ engine="realvirtuality" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" @@ -89,4 +89,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/BladeSymphony/bsserver b/BladeSymphony/bsserver index 632be094e..4aa7b5fec 100644 --- a/BladeSymphony/bsserver +++ b/BladeSymphony/bsserver @@ -41,8 +41,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/berimbau" executabledir="${filesdir}" @@ -95,4 +95,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/CounterStrike/csserver b/CounterStrike/csserver index fe93609bf..d4a51618d 100644 --- a/CounterStrike/csserver +++ b/CounterStrike/csserver @@ -40,7 +40,7 @@ engine="goldsource" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" -selfname="$0" +selfname="$(basename $0)" lockselfname=$(echo ".${servicename}.lock") filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/cstrike" @@ -94,4 +94,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/CounterStrikeGlobalOffensive/csgoserver b/CounterStrikeGlobalOffensive/csgoserver index 9a308792e..c3f90b476 100644 --- a/CounterStrikeGlobalOffensive/csgoserver +++ b/CounterStrikeGlobalOffensive/csgoserver @@ -58,8 +58,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/csgo" executabledir="${filesdir}" @@ -112,4 +112,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/CounterStrikeSource/cssserver b/CounterStrikeSource/cssserver index ad3b55033..d7c388de3 100644 --- a/CounterStrikeSource/cssserver +++ b/CounterStrikeSource/cssserver @@ -41,8 +41,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/cstrike" executabledir="${filesdir}" @@ -95,4 +95,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/DayOfDefeat/dodserver b/DayOfDefeat/dodserver index 01481b8e5..9cdec9838 100644 --- a/DayOfDefeat/dodserver +++ b/DayOfDefeat/dodserver @@ -40,8 +40,8 @@ engine="goldsource" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/dod" executabledir="${filesdir}" @@ -94,4 +94,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/DayOfDefeatSource/dodsserver b/DayOfDefeatSource/dodsserver index 471a3c600..430df7374 100644 --- a/DayOfDefeatSource/dodsserver +++ b/DayOfDefeatSource/dodsserver @@ -41,8 +41,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/dod" executabledir="${filesdir}" @@ -95,4 +95,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/FistfulOfFrags/fofserver b/FistfulOfFrags/fofserver index f8eb5cd59..790c5503f 100644 --- a/FistfulOfFrags/fofserver +++ b/FistfulOfFrags/fofserver @@ -41,8 +41,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/fof" executabledir="${filesdir}" @@ -95,4 +95,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/GarrysMod/gmodserver b/GarrysMod/gmodserver index 0bfbdfe62..b53c9ca2b 100644 --- a/GarrysMod/gmodserver +++ b/GarrysMod/gmodserver @@ -46,8 +46,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/garrysmod" executabledir="${filesdir}" @@ -100,4 +100,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/HalfLife2Deathmatch/hl2dmserver b/HalfLife2Deathmatch/hl2dmserver index 86fc4dadb..ecb7c6b44 100644 --- a/HalfLife2Deathmatch/hl2dmserver +++ b/HalfLife2Deathmatch/hl2dmserver @@ -41,8 +41,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/hl2mp" executabledir="${filesdir}" @@ -95,4 +95,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/HalfLifeDeathmatchClassic/hldmcserver b/HalfLifeDeathmatchClassic/hldmcserver index 7766baa5f..cc7e7e264 100644 --- a/HalfLifeDeathmatchClassic/hldmcserver +++ b/HalfLifeDeathmatchClassic/hldmcserver @@ -40,8 +40,8 @@ engine="goldsource" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/valve" executabledir="${filesdir}" @@ -94,4 +94,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/Insurgency/insserver b/Insurgency/insserver index 06cc3dd79..6d01da31e 100644 --- a/Insurgency/insserver +++ b/Insurgency/insserver @@ -41,8 +41,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/insurgency" executabledir="${filesdir}" @@ -95,4 +95,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/JustCause2/jc2server b/JustCause2/jc2server index 73d2ee643..59df04d32 100644 --- a/JustCause2/jc2server +++ b/JustCause2/jc2server @@ -37,8 +37,8 @@ engine="avalanche" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" @@ -90,4 +90,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/KillingFloor/kfserver b/KillingFloor/kfserver index 71ddd2b3c..15d5cc1a2 100644 --- a/KillingFloor/kfserver +++ b/KillingFloor/kfserver @@ -40,8 +40,8 @@ appid="215360" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/System" executabledir="${systemdir}" @@ -97,4 +97,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/Left4Dead/l4dserver b/Left4Dead/l4dserver index 78f87de42..a22a9922a 100644 --- a/Left4Dead/l4dserver +++ b/Left4Dead/l4dserver @@ -41,8 +41,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/left4dead" executabledir="${filesdir}" @@ -95,4 +95,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/Left4Dead2/l4d2server b/Left4Dead2/l4d2server index ea0af044c..d05edb059 100644 --- a/Left4Dead2/l4d2server +++ b/Left4Dead2/l4d2server @@ -40,8 +40,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/left4dead2" executabledir="${filesdir}" @@ -94,4 +94,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/Mumble/mumbleserver b/Mumble/mumbleserver index 1c05a8598..7dd5d63f1 100644 --- a/Mumble/mumbleserver +++ b/Mumble/mumbleserver @@ -18,8 +18,8 @@ servicename="mumble-server" # Directorys rootdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" ini="murmur.ini" executable="./murmur.x86 -fg -ini ${ini}" @@ -480,4 +480,4 @@ case "$1" in echo "Usage: $0 {start|stop|restart|monitor|debug|backup|email-test}" exit 1;; esac -exit \ No newline at end of file +exit diff --git a/NaturalSelection2/ns2server b/NaturalSelection2/ns2server index 87549e6af..585bc1fe3 100644 --- a/NaturalSelection2/ns2server +++ b/NaturalSelection2/ns2server @@ -50,8 +50,8 @@ engine="spark" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" @@ -100,4 +100,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/NoMoreRoomInHell/nmrihserver b/NoMoreRoomInHell/nmrihserver index 0936fd022..6502da312 100644 --- a/NoMoreRoomInHell/nmrihserver +++ b/NoMoreRoomInHell/nmrihserver @@ -41,8 +41,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/nmrih" executabledir="${filesdir}" @@ -95,4 +95,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/RedOrchestra/roserver b/RedOrchestra/roserver index f19f6a12a..f70b1d4b2 100644 --- a/RedOrchestra/roserver +++ b/RedOrchestra/roserver @@ -36,8 +36,8 @@ appid="223250" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/system" executabledir="${systemdir}" @@ -93,4 +93,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/SeriousSam3BFE/ss3sserver b/SeriousSam3BFE/ss3sserver index 17f3b36ba..d436c0a17 100644 --- a/SeriousSam3BFE/ss3sserver +++ b/SeriousSam3BFE/ss3sserver @@ -36,8 +36,8 @@ engine="seriousengine35" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/Bin" executabledir="${systemdir}" @@ -91,4 +91,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/TeamFortress2/tf2server b/TeamFortress2/tf2server index 622c06d8d..c269fa8d7 100644 --- a/TeamFortress2/tf2server +++ b/TeamFortress2/tf2server @@ -41,8 +41,8 @@ engine="source" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/tf" executabledir="${filesdir}" @@ -95,4 +95,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/TeamFortressClassic/tfcserver b/TeamFortressClassic/tfcserver index 9a6f763db..7336c6916 100644 --- a/TeamFortressClassic/tfcserver +++ b/TeamFortressClassic/tfcserver @@ -40,8 +40,8 @@ engine="goldsource" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename $0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/tfc" executabledir="${filesdir}" @@ -94,4 +94,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/TheHiddenSource/thsserver b/TheHiddenSource/thsserver index e5db4050c..d85381378 100644 --- a/TheHiddenSource/thsserver +++ b/TheHiddenSource/thsserver @@ -30,7 +30,7 @@ engine="source" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" -selfname="$0" +selfname="$(basename $0)" filesdir="${rootdir}/serverfiles" servercfg="${filesdir}/hidden/cfg/${servicename}.cfg" backupdir="backups" @@ -718,4 +718,4 @@ case "$1" in echo "Usage: $0 {start|stop|restart|update|monitor|install|debug|email-test|details}" exit 1;; esac -exit \ No newline at end of file +exit diff --git a/UnrealTournament2004/ut2k4server b/UnrealTournament2004/ut2k4server index ffb87e024..a2b75e97f 100644 --- a/UnrealTournament2004/ut2k4server +++ b/UnrealTournament2004/ut2k4server @@ -27,8 +27,8 @@ engine="unreal2" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename 0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/System" executabledir="${systemdir}" @@ -84,4 +84,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt diff --git a/UnrealTournament99/ut99server b/UnrealTournament99/ut99server index 05186e063..ce74bd2be 100644 --- a/UnrealTournament99/ut99server +++ b/UnrealTournament99/ut99server @@ -29,8 +29,8 @@ engine="unreal" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -selfname="$0" -lockselfname=$(echo ".${servicename}.lock") +selfname="$(basename 0)" +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/System" executabledir="${systemdir}" @@ -83,4 +83,4 @@ fn_runfunction fn_functions getopt=$1 -fn_getopt \ No newline at end of file +fn_getopt From 386b1cfc8cfe0bc4969007a1127b37ec62267444 Mon Sep 17 00:00:00 2001 From: Poil Date: Sun, 25 Jan 2015 21:39:42 +0100 Subject: [PATCH 3/7] missing fix --- CounterStrike/csserver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CounterStrike/csserver b/CounterStrike/csserver index d4a51618d..c9918ce9f 100644 --- a/CounterStrike/csserver +++ b/CounterStrike/csserver @@ -41,7 +41,7 @@ engine="goldsource" # Directories rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$(basename $0)" -lockselfname=$(echo ".${servicename}.lock") +lockselfname=".${servicename}.lock" filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/cstrike" executabledir="${filesdir}" From b1cd86d94c5edf98eb17deb6d6bad6c77ec934e4 Mon Sep 17 00:00:00 2001 From: Poil Date: Sun, 25 Jan 2015 21:53:14 +0100 Subject: [PATCH 4/7] Get all ip if ip=0.0.0.0 --- functions/fn_autoip | 15 +++------------ functions/fn_check_ip | 21 ++++----------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/functions/fn_autoip b/functions/fn_autoip index 6f38ec317..4af782c2b 100644 --- a/functions/fn_autoip +++ b/functions/fn_autoip @@ -12,17 +12,8 @@ if [ ! -f /bin/ip ]; then else ipcommand="ip" fi -getip=$(${ipcommand} -o -4 addr|awk '{print $4 }'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -v 127.0.0) -getipwc=$(${ipcommand} -o -4 addr|awk '{print $4 }'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -vc 127.0.0) +getip=$(hostname -I) if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then - if [ "${getipwc}" -ge "2" ]; then - fn_printwarn "Multiple active network interfaces found.\n\n" - echo -en "Manually specify the IP you want to use within the ${selfname} script.\n" - echo -en "Set ip=\"0.0.0.0\" to one of the following:\n" - echo -en "${getip}\n" - exit - else - ip=${getip} - fi -fi \ No newline at end of file + ip=${getip} +fi diff --git a/functions/fn_check_ip b/functions/fn_check_ip index f0ec52970..e5b2755c9 100644 --- a/functions/fn_check_ip +++ b/functions/fn_check_ip @@ -7,22 +7,9 @@ # Description: Automatically identifies the server interface IP. # If multiple interfaces are detected the user will need to manualy set using ip="0.0.0.0". -if [ ! -f /bin/ip ]; then - ipcommand="/sbin/ip" -else - ipcommand="ip" -fi -getip=$(${ipcommand} -o -4 addr|awk '{print $4 }'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -v 127.0.0) -getipwc=$(${ipcommand} -o -4 addr|awk '{print $4 }'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -vc 127.0.0) +getip=$(hostname -I) if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then - if [ "${getipwc}" -ge "2" ]; then - fn_printwarn "Multiple active network interfaces found.\n\n" - echo -en "Manually specify the IP you want to use within the ${selfname} script.\n" - echo -en "Set ip=\"0.0.0.0\" to one of the following:\n" - echo -en "${getip}\n" - exit - else - ip=${getip} - fi -fi \ No newline at end of file + ip=${getip} +fi + From b3bd56a2ada5626ca1477d365ccab4e5cfbfd7a1 Mon Sep 17 00:00:00 2001 From: Poil Date: Sun, 25 Jan 2015 22:02:36 +0100 Subject: [PATCH 5/7] Optim --- functions/fn_details_distro | 14 +++++++------- functions/fn_distrodetails | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/functions/fn_details_distro b/functions/fn_details_distro index 8f7a820ba..613aec491 100644 --- a/functions/fn_details_distro +++ b/functions/fn_details_distro @@ -48,12 +48,12 @@ if [ "$(free -h > /dev/null 2>&1; echo $?)" -ne "0" ]; then else option="-h" fi - physmemtotal=$(free ${option} | grep "Mem:" | awk '{print $2}') - physmemused=$(free ${option} | grep "Mem:" | awk '{print $3}') - physmemfree=$(free ${option} | grep "Mem:" | awk '{print $4}') - swaptotal=$(free ${option} | grep "Swap:" | awk '{print $2}') - swapused=$(free ${option} | grep "Swap:" | awk '{print $3}') - swapfree=$(free ${option} | grep "Swap:" | awk '{print $4}') +physmemtotal=$(free ${option} | awk '/Mem:/ {print $2}') +physmemused=$(free ${option} | awk '/Mem:/ {print $3}') +physmemfree=$(free ${option} | awk '/Mem:/ {print $4}') +swaptotal=$(free ${option} | | awk '/Swap:/ {print $2}') +swapused=$(free ${option} | awk '/Swap:/ {print $3}') +swapfree=$(free ${option} | awk '/Swap:/ {print $4}') # Uptime uptime=$( /dev/null 2>&1; echo $?)" -ne "0" ]; then else option="-h" fi - physmemtotal=$(free ${option} | grep "Mem:" | awk '{print $2}') - physmemused=$(free ${option} | grep "Mem:" | awk '{print $3}') - physmemfree=$(free ${option} | grep "Mem:" | awk '{print $4}') - swaptotal=$(free ${option} | grep "Swap:" | awk '{print $2}') - swapused=$(free ${option} | grep "Swap:" | awk '{print $3}') - swapfree=$(free ${option} | grep "Swap:" | awk '{print $4}') +physmemtotal=$(free ${option} | awk '/Mem:/ {print $2}') +physmemused=$(free ${option} | awk '/Mem:/ {print $3}') +physmemfree=$(free ${option} | awk '/Mem:/ {print $4}') +swaptotal=$(free ${option} | | awk '/Swap:/ {print $2}') +swapused=$(free ${option} | awk '/Swap:/ {print $3}') +swapfree=$(free ${option} | awk '/Swap:/ {print $4}') # Uptime uptime=$( Date: Sun, 25 Jan 2015 22:35:45 +0100 Subject: [PATCH 6/7] No error when links already exist --- functions/fn_check_logs | 8 ++++---- functions/fn_install_logs | 8 ++++---- functions/fn_loginstall | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/functions/fn_check_logs b/functions/fn_check_logs index 05c101f73..07d08bc5f 100644 --- a/functions/fn_check_logs +++ b/functions/fn_check_logs @@ -17,7 +17,7 @@ touch "${consolelog}" # If a server is source or goldsource create a symbolic link to the game server logs if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then if [ ! -h "${rootdir}/log/server" ]; then - ln -sv "${gamelogdir}" "${rootdir}/log/server" + ln -nfsv "${gamelogdir}" "${rootdir}/log/server" else echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!" fi @@ -28,15 +28,15 @@ if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]; then fi if [ "${gamename}" == "7 Days To Die" ]; then if [ ! -h "${gamelogdir}/output_log.txt" ]; then - ln -sv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" + ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" fi fi # If server uses SteamCMD create a symbolic link to the Steam logs if [ -d "${rootdir}/Steam/logs" ]; then if [ ! -h "${rootdir}/log/steamcmd" ]; then - ln -sv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" + ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" else echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!" fi fi -sleep 1 \ No newline at end of file +sleep 1 diff --git a/functions/fn_install_logs b/functions/fn_install_logs index 05c101f73..07d08bc5f 100644 --- a/functions/fn_install_logs +++ b/functions/fn_install_logs @@ -17,7 +17,7 @@ touch "${consolelog}" # If a server is source or goldsource create a symbolic link to the game server logs if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then if [ ! -h "${rootdir}/log/server" ]; then - ln -sv "${gamelogdir}" "${rootdir}/log/server" + ln -nfsv "${gamelogdir}" "${rootdir}/log/server" else echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!" fi @@ -28,15 +28,15 @@ if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]; then fi if [ "${gamename}" == "7 Days To Die" ]; then if [ ! -h "${gamelogdir}/output_log.txt" ]; then - ln -sv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" + ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" fi fi # If server uses SteamCMD create a symbolic link to the Steam logs if [ -d "${rootdir}/Steam/logs" ]; then if [ ! -h "${rootdir}/log/steamcmd" ]; then - ln -sv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" + ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" else echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!" fi fi -sleep 1 \ No newline at end of file +sleep 1 diff --git a/functions/fn_loginstall b/functions/fn_loginstall index 3920b8120..dc6fb8654 100644 --- a/functions/fn_loginstall +++ b/functions/fn_loginstall @@ -17,7 +17,7 @@ touch "${consolelog}" # If a server is source or goldsource create a symbolic link to the game server logs if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then if [ ! -h "${rootdir}/log/server" ]; then - ln -sv "${gamelogdir}" "${rootdir}/log/server" + ln -nfsv "${gamelogdir}" "${rootdir}/log/server" else echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!" fi @@ -28,15 +28,15 @@ if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]; then fi if [ "${gamename}" == "7 Days To Die" ]; then if [ ! -h "${gamelogdir}/output_log.txt" ]; then - ln -sv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" + ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" fi fi # If server uses SteamCMD create a symbolic link to the Steam logs if [ -d "${rootdir}/Steam/logs" ]; then if [ ! -h "${rootdir}/log/steamcmd" ]; then - ln -sv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" + ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" else echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!" fi fi -sleep 1 \ No newline at end of file +sleep 1 From 7dbbb3cbe76e5e939e72ed75057f4a59eb4a5d55 Mon Sep 17 00:00:00 2001 From: Poil Date: Sun, 25 Jan 2015 22:39:44 +0100 Subject: [PATCH 7/7] For ls ... PLEASE NO !!! --- functions/fn_compress_unreal2maps | 4 ++-- functions/fn_compress_ut99maps | 4 ++-- functions/fn_unreal2compressmaps | 4 ++-- functions/fn_ut99compressmaps | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions/fn_compress_unreal2maps b/functions/fn_compress_unreal2maps index 7b319baf8..9a3015f53 100644 --- a/functions/fn_compress_unreal2maps +++ b/functions/fn_compress_unreal2maps @@ -27,7 +27,7 @@ done mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 rm -rfv "${filesdir}/Maps/*.uz2" cd "${systemdir}" -for map in `ls "${filesdir}/Maps"`; do +for map in "${filesdir}/Maps/*"; do ./ucc-bin compress "../Maps/${map}" --nohomedir done -mv -fv "${filesdir}/Maps/*.uz2" "${compressedmapsdir}" \ No newline at end of file +mv -fv "${filesdir}/Maps/*.uz2" "${compressedmapsdir}" diff --git a/functions/fn_compress_ut99maps b/functions/fn_compress_ut99maps index 780ede5d9..250686972 100644 --- a/functions/fn_compress_ut99maps +++ b/functions/fn_compress_ut99maps @@ -27,7 +27,7 @@ done mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 rm -rfv "${filesdir}/Maps/*.unr.uz" cd "${systemdir}" -for map in `ls "${filesdir}/Maps"`; do +for map in "${filesdir}/Maps/*"; do ./ucc-bin compress ../Maps/${map} --nohomedir done -mv -fv "${filesdir}/Maps/*.unr.uz" "${compressedmapsdir}" \ No newline at end of file +mv -fv "${filesdir}/Maps/*.unr.uz" "${compressedmapsdir}" diff --git a/functions/fn_unreal2compressmaps b/functions/fn_unreal2compressmaps index f524e05b7..124efcc33 100644 --- a/functions/fn_unreal2compressmaps +++ b/functions/fn_unreal2compressmaps @@ -27,7 +27,7 @@ done mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 rm -rfv "${filesdir}/Maps/*.uz2" cd "${systemdir}" -for map in `ls "${filesdir}/Maps"`; do +for map in "${filesdir}/Maps/*"; do ./ucc-bin compress "../Maps/${map}" --nohomedir done -mv -fv "${filesdir}/Maps/*.uz2" "${compressedmapsdir}" \ No newline at end of file +mv -fv "${filesdir}/Maps/*.uz2" "${compressedmapsdir}" diff --git a/functions/fn_ut99compressmaps b/functions/fn_ut99compressmaps index 1d6ff1b7b..23466a01d 100644 --- a/functions/fn_ut99compressmaps +++ b/functions/fn_ut99compressmaps @@ -27,7 +27,7 @@ done mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 rm -rfv "${filesdir}/Maps/*.unr.uz" cd "${systemdir}" -for map in `ls "${filesdir}/Maps"`; do +for map in "${filesdir}/Maps/*"; do ./ucc-bin compress ../Maps/${map} --nohomedir done -mv -fv "${filesdir}/Maps/*.unr.uz" "${compressedmapsdir}" \ No newline at end of file +mv -fv "${filesdir}/Maps/*.unr.uz" "${compressedmapsdir}"