diff --git a/CounterStrike/csserver b/CounterStrike/csserver index f148ab4df..5cb14e4b6 100644 --- a/CounterStrike/csserver +++ b/CounterStrike/csserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -41,6 +41,7 @@ engine="goldsource" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/cstrike" executabledir="${filesdir}" @@ -465,6 +466,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -558,6 +565,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -583,6 +592,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -617,7 +628,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/CounterStrikeConditionZero/csczserver b/CounterStrikeConditionZero/csczserver index b7ae5a4a5..c06143de0 100644 --- a/CounterStrikeConditionZero/csczserver +++ b/CounterStrikeConditionZero/csczserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -41,6 +41,7 @@ engine="goldsource" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/czero" executabledir="${filesdir}" @@ -465,6 +466,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -558,6 +565,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -583,6 +592,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -617,7 +628,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/CounterStrikeGlobalOffensive/csgoserver b/CounterStrikeGlobalOffensive/csgoserver index 35a97280d..f17af6c4f 100644 --- a/CounterStrikeGlobalOffensive/csgoserver +++ b/CounterStrikeGlobalOffensive/csgoserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -59,6 +59,7 @@ engine="source" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/csgo" executabledir="${filesdir}" @@ -484,6 +485,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -577,6 +584,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -603,6 +612,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -637,7 +648,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/CounterStrikeSource/cssserver b/CounterStrikeSource/cssserver index a12387569..8c25a3120 100644 --- a/CounterStrikeSource/cssserver +++ b/CounterStrikeSource/cssserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -42,6 +42,7 @@ engine="source" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/cstrike" executabledir="${filesdir}" @@ -466,6 +467,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -559,6 +566,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -584,6 +593,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -618,7 +629,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/DayOfDefeat/dodserver b/DayOfDefeat/dodserver index 63de63619..c31ee25d8 100644 --- a/DayOfDefeat/dodserver +++ b/DayOfDefeat/dodserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -41,6 +41,7 @@ engine="goldsource" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/dod" executabledir="${filesdir}" @@ -253,7 +254,7 @@ else while true; do read -p "Do you want to start the server? [y/N]" yn case $yn in - [Yy]* ) fn_startserver;break;; + [Yy]* ) fn_startserver; break;; [Nn]* ) break;; * ) echo "Please answer yes or no.";; esac @@ -287,7 +288,7 @@ if [ ${tmuxwc} -eq 1 ]; then while true; do read -p "Would you like to stop ${servicename} while running the backup? [y/N]" yn case $yn in - [Yy]* ) fn_stopserver;break;; + [Yy]* ) fn_stopserver; break;; [Nn]* ) break;; * ) echo "Please answer yes or no.";; esac @@ -465,6 +466,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -558,6 +565,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -583,6 +592,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -617,7 +628,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/DayOfDefeatSource/dodsserver b/DayOfDefeatSource/dodsserver index 0db32ea82..30a5f4b66 100644 --- a/DayOfDefeatSource/dodsserver +++ b/DayOfDefeatSource/dodsserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -42,6 +42,7 @@ engine="source" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/dod" executabledir="${filesdir}" @@ -466,6 +467,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -559,6 +566,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -584,6 +593,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -618,7 +629,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/GarrysMod/gmodserver b/GarrysMod/gmodserver index 93e1fa62e..69a54b9b4 100644 --- a/GarrysMod/gmodserver +++ b/GarrysMod/gmodserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 190614 +# Version: 220614 #### Variables #### @@ -22,7 +22,6 @@ maxplayers="16" port="27015" sourcetvport="27020" clientport="27005" - ip="0.0.0.0" # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server @@ -35,7 +34,6 @@ parms="-game garrysmod -strictportbind -ip ${ip} -port ${port} +clientport ${cli # Steam appid="4020" - # Server Details servicename="gmod-server" gamename="Garrys's Mod" @@ -44,6 +42,7 @@ engine="source" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/garrysmod" executabledir="${filesdir}" @@ -468,6 +467,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -561,6 +566,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -586,6 +593,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -620,7 +629,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" @@ -854,4 +863,4 @@ case "$1" in echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install}" exit 1;; esac -exit +exit \ No newline at end of file diff --git a/HalfLife2Deathmatch/hl2dmserver b/HalfLife2Deathmatch/hl2dmserver index 84c6b62ab..3db43efb4 100644 --- a/HalfLife2Deathmatch/hl2dmserver +++ b/HalfLife2Deathmatch/hl2dmserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -19,7 +19,6 @@ steampass="" # Start Variables defaultmap="dm_lockdown" maxplayers="16" -tickrate="64" port="27015" sourcetvport="27020" clientport="27005" @@ -27,7 +26,7 @@ ip="0.0.0.0" # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server fn_parms(){ -parms="-game hl2mp -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} -tickrate ${tickrate} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +parms="-game hl2mp -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" } #### Advanced Variables #### @@ -43,6 +42,7 @@ engine="source" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/hl2mp" executabledir="${filesdir}" @@ -467,6 +467,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -560,6 +566,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -585,6 +593,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -619,7 +629,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/HalfLifeDeathmatchClassic/hldmcserver b/HalfLifeDeathmatchClassic/hldmcserver index 024ebcfc6..627631d83 100644 --- a/HalfLifeDeathmatchClassic/hldmcserver +++ b/HalfLifeDeathmatchClassic/hldmcserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -41,6 +41,7 @@ engine="goldsource" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/valve" executabledir="${filesdir}" @@ -465,6 +466,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -558,6 +565,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -583,6 +592,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -617,7 +628,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/Insurgency/insserver b/Insurgency/insserver index a39a00f3f..f075dfafb 100644 --- a/Insurgency/insserver +++ b/Insurgency/insserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -26,7 +26,7 @@ ip="0.0.0.0" # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server fn_parms(){ -parms="-strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +parms="-game insurgency -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" } #### Advanced Variables #### @@ -42,6 +42,7 @@ engine="source" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/insurgency" executabledir="${filesdir}" @@ -466,6 +467,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -559,6 +566,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -584,6 +593,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -618,7 +629,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/KillingFloor/kfserver b/KillingFloor/kfserver index 453961c93..0843d7e29 100644 --- a/KillingFloor/kfserver +++ b/KillingFloor/kfserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -22,6 +22,7 @@ appid="215360" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/System" executabledir="${systemdir}" @@ -456,6 +457,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -549,6 +556,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -574,6 +583,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 diff --git a/Left4Dead2/l4d2server b/Left4Dead2/l4d2server index c227360eb..d9cf84dd5 100644 --- a/Left4Dead2/l4d2server +++ b/Left4Dead2/l4d2server @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -20,13 +20,12 @@ steampass="" defaultmap="c5m1_waterfront" maxplayers="8" port="27015" -sourcetvport="27020" clientport="27005" ip="0.0.0.0" # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server fn_parms(){ -parms="-game left4dead2 -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +parms="-game left4dead2 -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" } #### Advanced Variables #### @@ -42,6 +41,7 @@ engine="source" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/left4dead2" executabledir="${filesdir}" @@ -466,6 +466,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -559,6 +565,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -584,6 +592,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -618,7 +628,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/NaturalSelection2/ns2server b/NaturalSelection2/ns2server index c11ccfaa5..6b8c73dc9 100644 --- a/NaturalSelection2/ns2server +++ b/NaturalSelection2/ns2server @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -45,6 +45,7 @@ engine="spark" # Directories selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}" executabledir="${filesdir}" @@ -359,7 +360,7 @@ if [ ! -z "${gamelogdir}" ]; then echo -e "\n\nServer log\n====================\n" >> "${emaillog}" tail "${gamelogdir}"/*|grep -v "==>"|sed '/^$/d'|tail -25 >> "${emaillog}" fi -cat -v "${emaillog}" | mail -s "${subject}" ${email} +mail -s "${subject}" ${email} < "${emaillog}" fn_printinfo "Sent email notification to ${email}" sleep 1 echo -en "\n" @@ -461,6 +462,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -554,6 +561,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -579,6 +588,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -818,4 +829,4 @@ case "$1" in echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install}" exit 1;; esac -exit +exit \ No newline at end of file diff --git a/NoMoreRoomInHell/nmrihserver b/NoMoreRoomInHell/nmrihserver index cc25a1178..a48ca22a5 100644 --- a/NoMoreRoomInHell/nmrihserver +++ b/NoMoreRoomInHell/nmrihserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -20,13 +20,12 @@ steampass="password" defaultmap="nmo_broadway" maxplayers="8" port="27015" -sourcetvport="27020" clientport="27005" ip="0.0.0.0" # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server fn_parms(){ -parms="-strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +parms="-strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" } #### Advanced Variables #### @@ -466,6 +465,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -559,6 +564,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -584,6 +591,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -618,7 +627,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/RedOrchestra/roserver b/RedOrchestra/roserver index fa298fd10..cb771b016 100644 --- a/RedOrchestra/roserver +++ b/RedOrchestra/roserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -22,6 +22,7 @@ appid="223250" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/system" executabledir="${systemdir}" @@ -452,6 +453,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -545,6 +552,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -570,6 +579,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 diff --git a/TeamFortress2/tf2server b/TeamFortress2/tf2server index 8c4bcd320..b0ad12d4f 100644 --- a/TeamFortress2/tf2server +++ b/TeamFortress2/tf2server @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -42,6 +42,7 @@ engine="source" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/tf" executabledir="${filesdir}" @@ -466,6 +467,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -559,6 +566,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -584,6 +593,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -618,7 +629,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/TeamFortressClassic/tfcserver b/TeamFortressClassic/tfcserver index 7d5c5978d..9b12032e5 100644 --- a/TeamFortressClassic/tfcserver +++ b/TeamFortressClassic/tfcserver @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -41,6 +41,7 @@ engine="goldsource" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/tfc" executabledir="${filesdir}" @@ -465,6 +466,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -558,6 +565,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -583,6 +592,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 @@ -617,7 +628,7 @@ echo "Ports the server is currently using." echo "" echo "DIRECTION DESCRIPTION PORT" echo "INBOUND Game/RCON port ${port}" -if [ "${engine}" = "source" ]; then +if [ ! -z ${sourcetvport} ]; then echo "INBOUND SourceTV port ${sourcetvport}" fi echo "OUTBOUND Client port ${clientport}" diff --git a/UnrealTournament2004/ut2k4server b/UnrealTournament2004/ut2k4server index 064af1720..c1e9fa415 100644 --- a/UnrealTournament2004/ut2k4server +++ b/UnrealTournament2004/ut2k4server @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -15,6 +15,7 @@ email="email@example.com" # Directorys rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" selfname="$0" +lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') filesdir="${rootdir}/serverfiles" systemdir="${filesdir}/System" executabledir="${systemdir}" @@ -445,6 +446,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -506,6 +513,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -531,6 +540,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1 diff --git a/UnrealTournament99/ut99server b/UnrealTournament99/ut99server index 7aedb1a44..fa4821e58 100644 --- a/UnrealTournament99/ut99server +++ b/UnrealTournament99/ut99server @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 050214 +# Version: 220614 #### Variables #### @@ -445,6 +445,12 @@ fn_monitorserver(){ fn_rootcheck fn_syscheck fn_autoip +if [ ! -f ${lockselfname} ]; then + fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled" + sleep 1 + echo -en "\n" + exit +fi fn_printdots "Monitoring ${servicename}: ${servername}" sleep 1 fn_scriptlog "Monitoring ${servername}" @@ -506,6 +512,8 @@ else fn_printok "Stopping ${servicename}: ${servername}" fn_scriptlog "Stopped ${servername}" fi +# Remove lock file +rm -f ${lockselfname} sleep 1 echo -en "\n" } @@ -531,6 +539,8 @@ if [ ${tmuxwc} -eq 1 ]; then fn_scriptlog "${servername} is already running" exit fi +# Create lock file +lockfile -r 0 ${lockselfname} cd "${executabledir}" tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'" sleep 1