Index: scripts/usr/local/lib/7dtd/VERSION
===================================================================
--- scripts/usr/local/lib/7dtd/VERSION	(revision 304)
+++ scripts/usr/local/lib/7dtd/VERSION	(revision 308)
@@ -1,3 +1,3 @@
-Version: 108
-Release: 2017-06-29
+Version: 109
+Release: 2017-08-07
 
Index: scripts/usr/local/lib/7dtd/commands/backup.sh
===================================================================
--- scripts/usr/local/lib/7dtd/commands/backup.sh	(revision 304)
+++ scripts/usr/local/lib/7dtd/commands/backup.sh	(revision 308)
@@ -48,9 +48,13 @@
 		fi
 	fi
-	
+
 	if [ ! -d $SDTD_BACKUP_ROOT ]; then
 		# Create new backup dir
 		mkdir $SDTD_BACKUP_ROOT
 	fi
+
+	for H in $(getHooksFor serverPreBackup); do
+		$H
+	done
 
 	$RSYNC -a --delete --numeric-ids --delete-excluded $SDTD_BASE/instances/./ $NewBackup
@@ -125,4 +129,11 @@
 		fi
 	done
+	for H in $(getHooksFor serverPostBackup); do
+		if [ "$SDTD_BACKUP_COMPRESS" = "all" ]; then
+			$H $NewBackup.tar.gz
+		else
+			$H $NewBackup
+		fi
+	done
 }
 
Index: scripts/usr/local/lib/7dtd/commands/instances.sh
===================================================================
--- scripts/usr/local/lib/7dtd/commands/instances.sh	(revision 304)
+++ scripts/usr/local/lib/7dtd/commands/instances.sh	(revision 308)
@@ -30,4 +30,7 @@
 		fi
 
+		if [ -z $cur ]; then
+			cur="?"
+		fi
 		max=$(getConfigValue $I ServerMaxPlayerCount)
 		port=$(getConfigValue $I ServerPort)
Index: scripts/usr/local/lib/7dtd/commands/updateengine.sh
===================================================================
--- scripts/usr/local/lib/7dtd/commands/updateengine.sh	(revision 304)
+++ scripts/usr/local/lib/7dtd/commands/updateengine.sh	(revision 308)
@@ -19,14 +19,48 @@
 
 sdtdCommandUpdateengine() {
-#	local FORCED=no
-#	if [ "$1" = "--force" ]; then
-#		FORCED=yes
-#	fi
-
-	local EXPERIMENTAL=no
-	if [ "$1" = "--experimental" ]; then
-		EXPERIMENTAL=yes
-	fi
-
+	local FORCED=no
+	local CHECKONLY=no
+	local SHOWINTERNAL=no
+	
+	local BRANCHNAME="$(getLocalBranch)"
+	local BRANCHPASSWORD=""
+	
+	while test $# -gt 0; do
+		case "$1" in
+			--check)
+				CHECKONLY=yes
+				;;
+			--showinternal)
+				SHOWINTERNAL=yes
+				;;
+			--experimental)
+				BRANCHNAME="latest_experimental"
+				;;
+			--stable)
+				BRANCHNAME="public"
+				;;
+			--branch)
+				if [ -z "$2" ]; then
+					echo "Argument --branch not followed by a branch name. Aborting."
+					return
+				fi
+				BRANCHNAME=$2
+				shift
+				;;
+			--password)
+				if [ -z "$2" ]; then
+					echo "Argument --password not followed by a branch password value. Aborting."
+					return
+				fi
+				BRANCHPASSWORD=$2
+				shift
+				;;
+			--force)
+				FORCED=yes
+				;;
+		esac
+		shift
+	done
+	
 	if [ ! -e $SDTD_BASE/steamcmd ]; then
 		mkdir $SDTD_BASE/steamcmd
@@ -37,17 +71,57 @@
 		./steamcmd.sh +quit
 	fi
-
-#	if [ "$1" = "--check" -o "$2" = "--check" ]; then
-#		local LOCAL=$(getLocalEngineVersion)
-#		local REMOTE=$(getRemoteEngineVersion)
-#		if [ $REMOTE -gt $LOCAL ]; then
-#			echo "Newer engine version available."
-#		else
-#			echo "Engine up to date."
-#		fi
-#		echo "Local buildid:     $LOCAL"
-#		echo "Available buildid: $REMOTE"
-#		return
-#	fi
+	
+	updateRemoteEngineInfo
+
+	if [ "$CHECKONLY" = "yes" ]; then
+		local LOCAL=$(getLocalEngineVersion)
+		local REMOTE=$(getBuildId $(getLocalBranch))
+		local REMOTETIME=$(getBuildUpdateTime $(getLocalBranch))
+		
+		echo "Installed:"
+		echo "  Build ID:     $(getLocalEngineVersion)"
+		echo "  Installed on: $(getLocalEngineUpdateTime)"
+		echo "  From branch:  $(getLocalBranch)"
+		echo
+
+		echo "Available branches:"
+		printf "%-*s | %-*s | %-*s\n" 22 "Branch" 8 "Build ID" 19 "Build set on"
+		printf -v line "%*s-+-%*s-+-%*s\n" 22 " " 8 " " 19 " "
+		echo ${line// /-}
+		for I in $(getBranchNames); do
+			if [[ $I != test* ]] || [ "$SHOWINTERNAL" = "yes" ]; then
+				local BUILD=$(getBuildId $I)
+				local CREATED=$(getBuildUpdateTime $I)
+				printf "%-*s | %*s | %2s\n" 22 "$I" 8 "$BUILD" "$CREATED"
+			fi
+		done | sort -k 3 -n -r
+		
+		echo
+		
+		if [ $REMOTE -gt $LOCAL ]; then
+			echo "Newer engine version available on the currently installed branch (build id $REMOTE from $REMOTETIME)."
+		else
+			local MAXREMOTE=0
+			local MAXREMOTEBRANCH=0
+			local MAXREMOTETIME=0
+			for I in $(getBranchNames); do
+				if [[ $I != test* ]] || [ "$SHOWINTERNAL" = "yes" ]; then
+					local BUILD=$(getBuildId $I)
+					local CREATED=$(getBuildUpdateTime $I)
+					if [ $BUILD -gt $MAXREMOTE ]; then
+						MAXREMOTE=$BUILD
+						MAXREMOTETIME=$CREATED
+						MAXREMOTEBRANCH=$I
+					fi
+				fi
+			done
+			if [ $MAXREMOTE -gt $LOCAL ]; then
+				echo "Newer engine version available on the branch \"$MAXREMOTEBRANCH\" (build id $MAXREMOTE from $MAXREMOTETIME)."
+			else
+				echo "Engine on the latest build."
+			fi
+		fi
+		return
+	fi
 
 	for I in $(getInstanceList); do
@@ -60,20 +134,12 @@
 
 	local LOCAL=$(getLocalEngineVersion)
-	#local REMOTE=$(getRemoteEngineVersion)
-	#local LOCAL_SUPPORTED_BUILD=$(cat /usr/local/lib/7dtd/VERSION | grep "DediBuild" | cut -d\  -f2)
-
-#	if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
-#		echo "A newer version of the engine is available."
-		echo "Local buildid:     $LOCAL"
-		#echo "Available buildid: $REMOTE"
+	local REMOTE=$(getBuildId $BRANCHNAME)
+
+	if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
+		echo "A newer version of the engine is available."
+		echo "Local build id:     $LOCAL (installed on $(getLocalEngineUpdateTime))"
+		echo "Available build id: $REMOTE (from $(getBuildUpdateTime $BRANCHNAME))"
 		echo
 
-#		if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
-#			echo "WARNING!!! The currently installed version of the scripts might not support the newer dedicated server build!"
-#			echo "If you continue you might not be able to start the server."
-#			echo "Please wait for an updated release of the scripts or continue at your own risk."
-#			echo
-#		fi
-	
 		while : ; do
 			local CONTINUE
@@ -93,11 +159,11 @@
 		done
 		
-		local BRANCH_PARAM=
-		if [ "$EXPERIMENTAL" = "yes" ]; then
-			BRANCH_PARAM="-beta latest_experimental"
-		fi
-		
 		cd $SDTD_BASE/steamcmd
-		./steamcmd.sh +login anonymous +force_install_dir $SDTD_BASE/engine +app_update 294420 -validate $BRANCH_PARAM +quit
+		local PASSWORDARG=
+		if [ -n "$BRANCHPASSWORD" ]; then
+			PASSWORDARG=-betapassword $BRANCHPASSWORD
+		fi
+		#echo ./steamcmd.sh +login anonymous +force_install_dir $SDTD_BASE/engine +app_update 294420 -validate -beta $BRANCHNAME $PASSWORDARG +quit
+		./steamcmd.sh +login anonymous +force_install_dir $SDTD_BASE/engine +app_update 294420 -validate -beta $BRANCHNAME $PASSWORDARG +quit
 
 		if [ -d /usr/local/lib/7dtd/server-fixes ]; then
@@ -106,29 +172,38 @@
 
 		chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine
-
-#		if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
-#			echo
-#			echo "Also update the scripts as soon as there is a new release for this dedicated server build."
-#			echo
-#		fi
-#	else
-#		echo "Engine is already at the newest build (local: $LOCAL, remote: $REMOTE)."
-#	fi
+	else
+		echo "Engine is already at the newest build on the selected branch \"$BRANCHNAME\" (local: $LOCAL, remote: $REMOTE)."
+		echo "Run with the --force parameter to update/validate the engine files anyway."
+		echo "Run with --experimental, --stable or --branch to switch to a different branch."
+	fi
 }
 
 sdtdCommandUpdateengineHelp() {
-	echo "Usage: $(basename $0) updateengine [--experimental]" # [--force | --check]"
+	echo "Usage: $(basename $0) updateengine [--check [--showinternal]] [--experimental | --stable] [--branch BRANCHNAME [--password BRANCHPASSWORD]] [--force]"
 	echo
 	echo "Check for a newer version of engine (aka game) files of 7dtd. If there is a newer"
 	echo "version they will be updated by this command."
 	echo
-	echo "If --experimental is specified the server will be updated to the"
+	echo "If neither --stable, nor --experimental nor --branch is specified the server will"
+	echo "updated to the latest build on the currently installed Steam branch of the game."
+	echo
+	echo "If --stable is specified the server will be switched to the"
+	echo "default public stable Steam branch of the game."
+	echo
+	echo "If --experimental is specified the server will be switched to the"
 	echo "latest_experimental Steam branch of the game."
-#	echo
-#	echo "If --force is specified you are asked if you want to redownload the engine"
-#	echo "even if there is no new version available."
-#	echo
-#	echo "If --check is specified it will only output the current local and remote build ids"
-#	echo "and if an update is available."
+	echo
+	echo "If --branch SOMEBRANCH is specified the server will be switched to the"
+	echo "given Steam branch of the game. Additionally if password is required to acess"
+	echo "the branch this can be specified with the --password argument."
+	echo "NOTE that --password is also required if you previously switched to a branch that"
+	echo "requires a password and want to update to the latest build on that branch now."
+	echo
+	echo "If --force is specified you are asked if you want to redownload the engine"
+	echo "even if there is no new version detected."
+	echo
+	echo "If --check is specified it will only output the current local and remote build ids"
+	echo "and if an update is available."
+	echo "TFP internal branches are only shown if --showinternal is also given."
 }
 
@@ -138,15 +213,75 @@
 
 sdtdCommandUpdateengineExpects() {
-	case $1 in
-		2)
-			echo "--experimental"
-			;;
-	esac
-#	case $1 in
-#		2)
-#			echo "--force --check"
-#			;;
-#	esac
-	echo
-}
-
+	if [ "$2" = "--password" ]; then
+		echo ""
+	elif [ "$2" = "--branch" ]; then
+		updateRemoteEngineInfo
+		getBranchNames
+	else
+		echo "--check --showinternal --experimental --branch --password --stable --force"
+	fi
+}
+
+# Get the latest remote (on Steam) engine version numbers etc
+updateRemoteEngineInfo() {
+	local DOCHECK=no
+	if [ ! -e /tmp/7dtd-appinfo ]; then
+		DOCHECK=yes
+	else
+		AGE=$((`date +%s` - `stat -L --format %Y /tmp/7dtd-appinfo`))
+		if [ $AGE -gt 600 ]; then
+			DOCHECK=yes
+		fi
+	fi
+	if [ "$DOCHECK" = "yes" ]; then
+		cd $SDTD_BASE/steamcmd
+
+		./steamcmd.sh +login anonymous +app_info_request 294420 +app_info_update 1 +app_info_print 294420 +quit | grep -A 1000 \"294420\" 2>/dev/null > /tmp/7dtd-appinfo
+	
+		local BUILDID=$(grep -A 1000 \"branches\" /tmp/7dtd-appinfo | grep -A 1000 \"public\" | grep -B 10 \} --max-count=1 | grep \"buildid\" | cut -d\" -f4)
+
+		if [ $(isANumber "$BUILDID") -eq 0 ]; then
+			rm -f /tmp/7dtd-appinfo
+		fi
+	fi
+}
+
+# Get the latest build id (on Steam)
+# Params:
+#   1. Branch name
+# Returns:
+#   "?" if data could not be retrieved
+#   BuildId otherwise
+getBuildId() {
+	local BUILDID=$(grep -A 1000 \"branches\" /tmp/7dtd-appinfo | grep -A 1000 \"$1\" | grep -B 10 \} --max-count=1 | grep \"buildid\" | cut -d\" -f4)
+
+	if [ $(isANumber "$BUILDID") -eq 0 ]; then
+		echo "?"
+	else
+		echo $BUILDID
+	fi
+}
+
+# Get the update time of the latest build (on Steam)
+# Params:
+#   1. Branch name
+# Returns:
+#   "?" if data could not be retrieved
+#   Update timestamp otherwise
+getBuildUpdateTime() {
+	local TIMESTAMP=$(grep -A 1000 \"branches\" /tmp/7dtd-appinfo | grep -A 1000 \"$1\" | grep -B 10 \} --max-count=1 | grep \"timeupdated\" | cut -d\" -f4)
+	
+	if [ $(isANumber "$TIMESTAMP") -eq 0 ]; then
+		echo "?"
+	else
+		date --date="@${TIMESTAMP}" "+%Y-%m-%d %H:%M:%S"
+	fi
+}
+
+# Get a list of available branch names, blank separated
+# Returns:
+#   Blank separated list of branch names (can be empty if an error occured)
+getBranchNames() {
+	grep -A 1000 \"branches\" /tmp/7dtd-appinfo | grep -E '^[[:space:]]*"[^"]+"[[:space:]]*$' | tail --lines=+2 | cut -d\" -f2
+}
+
Index: scripts/usr/local/lib/7dtd/commands/updatescripts.sh
===================================================================
--- scripts/usr/local/lib/7dtd/commands/updatescripts.sh	(revision 304)
+++ scripts/usr/local/lib/7dtd/commands/updatescripts.sh	(revision 308)
@@ -62,15 +62,17 @@
 		cd $TMPPATH
 		for SRCFILE in `find * -type f`; do
-			DESTFOLDER=/`dirname $SRCFILE`
-			mkdir -p $DESTFOLDER
-			cp -a $SRCFILE $DESTFOLDER/
+			if [[ $SRCFILE != etc* ]] || [[ $SRCFILE == etc/bash_completion+ ]]; then
+				DESTFOLDER=/`dirname $SRCFILE`
+				mkdir -p $DESTFOLDER
+				cp -a $SRCFILE $DESTFOLDER/
+			fi
 		done
 		rm -R $TMPPATH
 
-		chown root.root /etc/init.d/7dtd.sh
+#		chown root.root /etc/init.d/7dtd.sh
 		chown root.root /etc/bash_completion.d/7dtd
 		chown root.root /usr/local/bin/7dtd.sh
 		chown root.root /usr/local/lib/7dtd -R
-		chmod 0755 /etc/init.d/7dtd.sh
+#		chmod 0755 /etc/init.d/7dtd.sh
 		chmod 0755 /etc/bash_completion.d/7dtd
 		chmod 0755 /usr/local/bin/7dtd.sh
Index: scripts/usr/local/lib/7dtd/common.sh
===================================================================
--- scripts/usr/local/lib/7dtd/common.sh	(revision 304)
+++ scripts/usr/local/lib/7dtd/common.sh	(revision 308)
@@ -111,4 +111,23 @@
 }
 
+# Get the installed branch name
+# Returns:
+#   "public" if no engine installed or no appmanifest found or buildid could not be read
+#   Branch name
+getLocalBranch() {
+	local APPMANIFEST=$(find $SDTD_BASE/engine -type f -name "appmanifest_294420.acf")
+	local LOCAL="public"
+	if [ -f "$APPMANIFEST" ]; then
+		LOCAL=$(grep betakey "$APPMANIFEST" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\  -f3)
+		if [[ -z $LOCAL ]]; then
+			LOCAL="public"
+		else
+			echo $LOCAL
+			return
+		fi
+	fi
+	echo $LOCAL
+}
+
 # Get the local engine version number (i.e. build id)
 # Returns:
@@ -127,16 +146,21 @@
 }
 
-# Get the latest remote engine version number (i.e. build id)
-# Returns:
-#   1 if build id could not be retrieved
-#   Build Id otherwise
-getRemoteEngineVersion() {
-	cd $SDTD_BASE/steamcmd
-	local REMOTE=$(wget -qO- http://steamdb.info/api/GetRawDepots/?appid=294420 | sed 's/\\n/\n/g' | grep -EA 1000 "^\s+\[branches\]" | grep -EA 5 "^\s+\[public\]" | grep -m 1 -EB 10 "^\s+\)$" | grep -E "^\s+\[buildid\]\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\  -f4)
-
-	if [ $(isANumber "$REMOTE") -eq 0 ]; then
-		REMOTE=1
-	fi
-	echo $REMOTE
+# Get the local engine update time
+# Returns:
+#   0 if no engine installed or no appmanifest found or buildid could not be read
+#   Update time otherwise
+getLocalEngineUpdateTime() {
+	local APPMANIFEST=$(find $SDTD_BASE/engine -type f -name "appmanifest_294420.acf")
+	local LOCAL=0
+	if [ -f "$APPMANIFEST" ]; then
+		LOCAL=$(grep LastUpdated "$APPMANIFEST" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\  -f3)
+		if [ $(isANumber "$LOCAL") -eq 0 ]; then
+			LOCAL=0
+		else
+			date --date="@${LOCAL}" "+%Y-%m-%d %H:%M:%S"
+			return
+		fi
+	fi
+	echo $LOCAL
 }
 
@@ -234,5 +258,5 @@
 #   Names of hook files
 getHooksFor() {
-	if [ -n $2 ]; then
+	if [ -n "$2" ]; then
 		if [ -d $(getInstancePath $2)/hooks/$1 ]; then
 			local H
Index: scripts/usr/local/lib/7dtd/monitor-log.sh
===================================================================
--- scripts/usr/local/lib/7dtd/monitor-log.sh	(revision 304)
+++ scripts/usr/local/lib/7dtd/monitor-log.sh	(revision 308)
@@ -56,4 +56,17 @@
 	for H in $(getHooksFor playerDisconnect $INSTANCE); do
 		$H $INSTANCE "$playerId" "$entityId" "$NICKNAME" "$STEAMID"
+	done
+}
+
+handlePlayerSpawnedInWorld() {
+	local entityId="$1"
+	local playerId="$2"
+	local ownerId="$3"
+	local playerName="$4"
+	local reason="$5"
+	local position="$6"
+	
+	for H in $(getHooksFor playerSpawned $INSTANCE); do
+		$H $INSTANCE "$entityId" "$playerId" "$ownerId" "$playerName" "$reason" "$position"
 	done
 }
@@ -133,34 +146,39 @@
 			handleConnect "$entityId" "$playerName" "$steamId" "$ip" "$steamOwner"
 			unset entityId playerName steamId steamOwner ip
-		else
 		#Player disconnected: EntityID=[0-9]*, PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$ 
-		if [ -n "$(echo "$line" | grep '^Player disconnected: ')" ]; then 
+		elif [ -n "$(echo "$line" | grep '^Player disconnected: ')" ]; then 
 			playerId=$(expr "$line" : "Player disconnected: EntityID=[0-9]*, PlayerID='\([0-9]*\)', OwnerID='[0-9]*', PlayerName='.*'$") 
 			entityId=$(expr "$line" : "Player disconnected: EntityID=\([0-9]*\), PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$") 
 			handleDisconnect "$playerId" "$entityId"
 			unset playerId entityId
-		else
+		#PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='.*'
+		elif [ -n "$(echo "$line" | grep '^PlayerSpawnedInWorld ')" ]; then
+			reason=$(expr "$line" : "PlayerSpawnedInWorld (reason: \(.+\), position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='.*'$") 
+			position=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: \([0-9]+, [0-9]+, [0-9]+\)): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='.*'$") 
+			entityId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=\([0-9]+\), PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='.*'$") 
+			playerId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='\([0-9]+\)', OwnerID='[0-9]+', PlayerName='.*'$") 
+			ownerId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='\([0-9]+\)', PlayerName='.*'$") 
+			playerName=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='\(.*\)'$") 
+			handlePlayerSpawnedInWorld "$entityId" "$playerId" "$ownerId" "$playerName" "$reason" "$position"
+			unset reason position entityId playerId ownerId playerName
 		#GMSG: .*$
-		if [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then
+		elif [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then
 			msg=$(expr "$line" : 'GMSG: \(.*\)$')
 			handleGmsg "$msg"
 			unset msg
-		else
 		#Chat: 'name': .*$
-		if [ -n "$(echo "$line" | grep -E '^Chat: .+')" ]; then
+		elif [ -n "$(echo "$line" | grep -E '^Chat: .+')" ]; then
 			name=$(expr "$line" : "Chat: '\(.*\)': .*$")
 			msg=$(expr "$line" : "Chat: '.*': \(.*\)$")
 			handleChat "$name" "$msg"
 			unset name msg
-		else
 		#Executing command ".*" from client ".*"$ 
-		if [ -n "$(echo "$line" | grep '^Executing command '.*' from client')" ]; then 
+		elif [ -n "$(echo "$line" | grep '^Executing command '.*' from client')" ]; then 
 			cmd=$(expr "$line" : "Executing command '\(.*\)' from client .*$") 
 			nick=$(expr "$line" : "Executing command '.*' from client \(.*\)$") 
 			handleRemoteCommand "$cmd" "$nick"
 			unset cmd nick
-		else
 		#Executing command ".*" by Telnet from .*$ 
-		if [ -n "$(echo "$line" | grep '^Executing command '.*' by Telnet from ')" ]; then 
+		elif [ -n "$(echo "$line" | grep '^Executing command '.*' by Telnet from ')" ]; then 
 			cmd=$(expr "$line" : "Executing command '\(.*\)' by Telnet from .*$") 
 			ip=$(expr "$line" : "Executing command '.*' by Telnet from \(.*\)$") 
@@ -168,9 +186,4 @@
 			unset cmd ip
 		fi
-		fi
-		fi
-		fi
-		fi
-		fi
 	fi
 done
Index: scripts/usr/local/lib/7dtd/serverconfig.sh
===================================================================
--- scripts/usr/local/lib/7dtd/serverconfig.sh	(revision 304)
+++ scripts/usr/local/lib/7dtd/serverconfig.sh	(revision 308)
@@ -330,5 +330,5 @@
 }
 serverconfig_DayNightLength_Default() {
-	echo "50"
+	echo "60"
 }
 
