Index: /bootstrapper/bootstrap.sh
===================================================================
--- /bootstrapper/bootstrap.sh	(revision 505)
+++ /bootstrapper/bootstrap.sh	(revision 1)
@@ -1,31 +1,10 @@
 #!/bin/bash
-VERSION=8
-
-#   Copyright 2016 Christian 'Alloc' Illy
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-
-
-if [ `id -u` -ne 0 ]; then
-	echo "This script has to be run as root!"
-	exit 1
-fi
-
-
+
+INSTALLOPTIONALDEPS=0
 ADDCRONJOBS=0
 RUNINSTALL=0
-INSTALLOPTIONALDEPS=0
-
-DEPENDENCIES="gcc wget rsync xmlstarlet expect"
+
+DEPENDENCIES="xvfb mono-runtime screen rsync libxml2-utils"
+OPTDEPENDENCIES="sendemail sendxmpp"
 
 if [ -n "$(command -v apt-get)" ]; then
@@ -41,16 +20,16 @@
 fi
 
-if [ $IS64BIT -eq 1 ]; then
-	DEPENDENCIES="$DEPENDENCIES lib32gcc-s1"
+if [[ $IS64BIT == 1 ]]; then
+	DEPENDENCIES="$DEPENDENCIES lib32gcc1 wine:i386"
+else
+	DEPENDENCIES="$DEPENDENCIES wine"
 fi
 
 showHelp() {
-	echo "7dtd bootstrapper version $VERSION"
-	echo
-	echo "Usage: ./bootstrap.sh [-h] [-c] -i"
+	echo "Usage: ./bootstrap.sh [-h] [-o] [-c] -i"
 	echo "Parameters:"
 	echo "  -h   Print this help screen and exit"
-#	echo "  -o   Install optional dependencies ($OPTDEPENDENCIES)"
-	echo "  -c   Enable cron job for automatic backups"
+	echo "  -o   Install optional dependencies ($OPTDEPENDENCIES)"
+	echo "  -c   Add cron jobs for save backups and memory checking"
 	echo "  -i   Required to actually start the installation"
 }
@@ -62,5 +41,5 @@
 	echo "This will install a 7DtD server according to the information"
 	echo "given on:"
-	echo "   https://7dtd.illy.bz/"
+	echo "   http://7daystodie.gamepedia.com/Linux_Server"
 	echo
 	read -p "Press enter to continue"
@@ -69,12 +48,10 @@
 
 nonDebianWarning() {
-	if [ $ISDEBIAN -eq 0 ]; then
+	if [[ $ISDEBIAN == 0 ]]; then
 		echo "NOTE: It seems like this system is not based on Debian."
 		echo "Although installation of the scripts and SteamCMD/7dtd"
 		echo "will work the installed management scripts will probably"
-		echo "fail because of missing dependencies. Make sure you check"
-		echo "the website regarding the prerequisites"
-		echo "(https://7dtd.illy.bz)."
-		echo
+		echo "*NOT* work out of the box and installation of dependencies"
+		echo "will fail too."
 		echo "Do you want to continue anyway?"
 		select yn in "Yes" "No"; do
@@ -95,5 +72,5 @@
 installAptDeps() {
 	echo -e "Installing dependencies\n"
-	if [ $IS64BIT -eq 1 ]; then
+	if [[ $IS64BIT == 1 ]]; then
 		dpkg --add-architecture i386
 	fi
@@ -109,51 +86,4 @@
 }
 
-checkSetupDeps() {
-	for DEP in gcc wget tr rsync xmlstarlet expect; do
-		which $DEP > /dev/null 2>&1
-		if [ $? -ne 0 ]; then
-			echo "\"$DEP\" not installed. Please install it and run this script again."
-			exit 1
-		fi
-	done
-	
-	ldconfig -p | grep ld-linux | grep "(ELF)" > /dev/null
-	if [ $? -ne 0 ]; then
-		echo "WARNING: There probably is no 32 Bit version of ld-linux installed."
-		echo "This is most probably part of a 32 Bit version of a glibc-package."
-		echo
-		echo "It will result in errors trying to run SteamCMD if this library is not available!."
-		echo "Do you want to continue anyway?"
-		select yn in "Yes" "No"; do
-			case $yn in
-				Yes)
-					break;;
-				No)
-					echo "Aborting."
-					exit 1
-					;;
-			esac
-		done
-	fi
-
-	ldconfig -p | grep gcc | grep -v 64 > /dev/null
-	if [ $? -ne 0 ]; then
-		echo "WARNING: There probably is no 32 Bit version of libgcc installed."
-		echo
-		echo "It will result in errors trying to run SteamCMD if this library is not available!"
-		echo "Do you want to continue anyway?"
-		select yn in "Yes" "No"; do
-			case $yn in
-				Yes)
-					break;;
-				No)
-					echo "Aborting."
-					exit 1
-					;;
-			esac
-		done
-	fi
-}
-
 setupUser() {
 	echo -e "Setting up user and group \"sdtd\"\n"
@@ -164,43 +94,22 @@
 installManagementScripts() {
 	echo -e "Downloading and installing management scripts\n"
-	wget -nv https://illy.bz/fi/7dtd/management_scripts.tar.gz -O /tmp/management_scripts.tar.gz
-	TMPPATH=`mktemp -d`
-	tar --touch --no-overwrite-dir -xzf /tmp/management_scripts.tar.gz -C $TMPPATH
-	cd $TMPPATH
-	for SRCFILE in `find * -type f`; do
-		DESTFOLDER=/`dirname $SRCFILE`
-		mkdir -p $DESTFOLDER
-		cp -a $SRCFILE $DESTFOLDER/
-	done
-	rm -R $TMPPATH
-
-	chown root:root /etc/7dtd.conf
-	chmod 0600 /etc/7dtd.conf
-
-	chown sdtd:sdtd /home/sdtd -R
-
-	chown root:root /etc/init.d/7dtd.sh
-	chown root:root /etc/bash_completion.d/7dtd
-	chown root:root /etc/cron.d/7dtd-backup
-	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/bash_completion.d/7dtd
-	chmod 0755 /etc/cron.d/7dtd-backup
-	chmod 0755 /usr/local/bin/7dtd.sh
-	chmod 0755 /usr/local/lib/7dtd -R
-
-	if [ $ISDEBIAN -eq 1 ]; then
+	wget -nv http://illy.bz/fi/7dtd/management_scripts.tar.gz -O /tmp/management_scripts.tar.gz
+	tar -xzf /tmp/management_scripts.tar.gz --no-same-owner --owner=root --group=root -C /
+	chmod go-rwx /etc/7dtd.conf
+	chmod +x /etc/init.d/7dtd.sh
+	chmod +x /usr/local/bin/7dtd-*
+	if [[ $ISDEBIAN == 1 ]]; then
 		update-rc.d 7dtd.sh defaults
 	fi
-	
-	echo
-	echo "Compiling start-stop-daemon"
-	cd /usr/local/lib/7dtd/start-stop-daemon
-
-	gcc -Wall -Wextra -Wno-return-type -o start-stop-daemon start-stop-daemon.c
-	chown root:root start-stop-daemon
-	chmod 0755 start-stop-daemon
-
+	echo -e "\n=============================================================\n\n"
+}
+
+setSteamLoginData() {
+	echo -e "Steam account data\n"
+	echo "Please enter your Steam login data for SteamCMD to get the 7dtd-server files:"
+	read -p "Steam username: " username
+	read -s -p "Steam password: " password
+	sed -i "s/export STEAM_USER=/export STEAM_USER=$username/" /etc/7dtd.conf
+	sed -i "s/export STEAM_PASS=/export STEAM_PASS=$password/" /etc/7dtd.conf
 	echo -e "\n=============================================================\n\n"
 }
@@ -208,43 +117,82 @@
 installSteamCmdAndSDTD() {
 	echo -e "Installing SteamCMD and 7DtD\n"
-	7dtd.sh updateengine
+	7dtd-update.sh
+	cp -p /home/sdtd/7dtd/serverconfig.xml /home/sdtd/
+	echo -e "\n=============================================================\n\n"
+}
+
+setupServerConfig() {
+	echo -e "Setting up basic 7DtD server config\n"
+
+	until [[ $public == "y" || $public == "n" ]]; do
+		read -p "Should the server be public [yn]? " public
+	done
+	if [[ "$public" == "y" ]]; then public=true; else public=false; fi
+	echo
+
+	read -p "Server name: " servername
+	echo
+	read -p "Server password (empty for none): " serverpassword
+	echo
+
+	echo "Select world to play on:"
+	select worldname in "Navezgane" "MP Forest Horde" "MP Forest Skirmish" "MP Wasteland Horde" "MP Wasteland Skirmish" "MP Wasteland War"; do
+		if [[ -n $worldname ]]; then
+			break
+		fi
+	done
+	echo
+
+	echo "Select game mode:"
+	select gamemode in "GameModeSurvival" "GameModeZombieHorde" "GameModeDeathmatch"; do
+		if [[ -n $gamemode ]]; then
+			break
+		fi
+	done
+	echo
+
+	read -p "Game name: " gamename
+	echo
+	read -p "Difficulty (0-4): " difficulty
+	echo
+
+	sed -i "s/name=\"ServerIsPublic\".*value=\"[^\"]*\"/name=\"ServerIsPublic\" value=\"$public\"/" /home/sdtd/serverconfig.xml
+	sed -i "s/name=\"ServerName\".*value=\"[^\"]*\"/name=\"ServerName\" value=\"$servername\"/" /home/sdtd/serverconfig.xml
+	sed -i "s/name=\"ServerPassword\".*value=\"[^\"]*\"/name=\"ServerPassword\" value=\"$serverpassword\"/" /home/sdtd/serverconfig.xml
+	sed -i "s/name=\"GameWorld\".*value=\"[^\"]*\"/name=\"GameWorld\" value=\"$worldname\"/" /home/sdtd/serverconfig.xml
+	sed -i "s/name=\"GameName\".*value=\"[^\"]*\"/name=\"GameName\" value=\"$gamename\"/" /home/sdtd/serverconfig.xml
+	sed -i "s/name=\"GameDifficulty\".*value=\"[^\"]*\"/name=\"GameDifficulty\" value=\"$difficulty\"/" /home/sdtd/serverconfig.xml
+	sed -i "s/name=\"GameMode\".*value=\"[^\"]*\"/name=\"GameMode\" value=\"$gamemode\"/" /home/sdtd/serverconfig.xml
+	sed -i "s/name=\"TelnetPort\".*value=\"[^\"]*\"/name=\"TelnetPort\" value=\"25003\"/" /home/sdtd/serverconfig.xml
+
 	echo -e "\n=============================================================\n\n"
 }
 
 addCronJobs() {
-	echo -e "Enabling backup cron job\n"
+	echo -e "Adding cron jobs\n"
 
 	echo -e "By default a backup of the save folder will be created once"
 	echo -e "  per hour. This can be changed in /etc/cron.d/7dtd-backup."
-	
-	cat /etc/cron.d/7dtd-backup | tr -d '#' > /tmp/7dtd-backup
-	cp /tmp/7dtd-backup /etc/cron.d
-
+	echo -e "Memory monitor will be run every five minutes by default."
+	echo -e "  This can be changed in /etc/cron.d/7dtd-check_mem."
+
+	echo "0 *     * * *   root    /usr/local/bin/7dtd-backup.sh" > /etc/cron.d/7dtd-backup
+	echo "*/5 *   * * *   root    /usr/local/bin/7dtd-check_mem.sh" > /etc/cron.d/7dtd-check_mem
+
+	echo -e "\nNOTE: Do not forget to edit /etc/7dtd.conf to match\nyour notification needs!"
 	echo -e "\n=============================================================\n\n"
 }
 
 finish() {
-	if [ $ISDEBIAN -eq 0 ]; then
-		echo
-		echo "You are not running a Debian based distribution."
-		echo "The following things should manually be checked:"
-		echo " - Existence of prerequsities"
-		echo " - Running the init-script on boot"
-	else
-		echo -e "\n ALL DONE"
-	fi
-
-	echo
-	echo -e "You can now continue setting up instances as explained on the website:"
-	echo -e "  https://7dtd.illy.bz/wiki/Instance%20management"
-	echo
-	echo -e "You might also need to manually enable bash auto completion, refer to:"
-	echo -e "  https://7dtd.illy.bz/wiki/Installation#Bashcompletion"
+	echo -e "\n ALL DONE\n"
+	echo -e "You should now be able to start your 7dtd server by running\n"
+	echo -e "      7dtd-start.sh\n"
 	echo
 	echo -e "For further configuration options check:"
 	echo -e "  /etc/7dtd.conf"
-	echo
-	echo -e "For feedback, suggestions, problems please visit the bugtracker:"
-	echo -e "  https://7dtd.illy.bz/"
+	echo -e "  /home/sdtd/serverconfig.xml"
+	echo
+	echo -e "For feedback, suggestions, problems please visit the forum:"
+	echo -e "  http://7daystodie.com/forums/showthread.php?2188"
 	echo
 }
@@ -254,23 +202,23 @@
 	nonDebianWarning
 
-	if [ $ISDEBIAN -eq 1 ]; then
+	if [[ $ISDEBIAN == 1 ]]; then
 		installAptDeps
-		if [ $INSTALLOPTIONALDEPS -eq 1 ]; then
-#			installOptionalDeps
+		if [[ $INSTALLOPTIONALDEPS == 1 ]]; then
+			installOptionalDeps
 			echo
 		fi
-	else
-		checkSetupDeps
 	fi
 	setupUser
 	installManagementScripts
+	setSteamLoginData
 	installSteamCmdAndSDTD
-	if [ $ADDCRONJOBS -eq 1 ]; then
+	if [[ $ADDCRONJOBS == 1 ]]; then
 		addCronJobs
 	fi
+	setupServerConfig
 	finish
 }
 
-if [ -z $1 ]; then
+if [[ -z $1 ]]; then
 	showHelp
 	exit 0
@@ -293,5 +241,5 @@
 	esac
 done
-if [ $RUNINSTALL -eq 1 ]; then
+if [[ $RUNINSTALL == 1 ]]; then
 	main
 fi
Index: /scripts/etc/7dtd.conf
===================================================================
--- /scripts/etc/7dtd.conf	(revision 505)
+++ /scripts/etc/7dtd.conf	(revision 1)
@@ -1,33 +1,15 @@
 #!/bin/sh
 
-#   Copyright 2016 Christian 'Alloc' Illy
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
+# Root directory where steamcmd should be placed
+export STEAMCMD_ROOT=/home/sdtd/steamcmd
+export STEAM_USER=
+export STEAM_PASS=
 
+# Root directory of the engine
+export SDTD_ROOT=/home/sdtd/7dtd
+export SDTD_SERVERCONFIG=$SDTD_ROOT/../serverconfig.xml
 
-# Root of the 7dtd folders, containing e.g. the "engine", "instances" folders
-export SDTD_BASE=/home/sdtd
-
-# How many seconds should stopping wait for the instance to shutdown
-export STOP_WAIT=5
-
-# Backup options
+# Root directory for backups
 export SDTD_BACKUP_ROOT=/home/sdtd/backup
-export SDTD_BACKUP_SAVEWORLD=true
-export SDTD_BACKUP_MIN_BACKUPS_KEEP=
-export SDTD_BACKUP_MAX_BACKUPS=
-export SDTD_BACKUP_MAX_STORAGE=
-export SDTD_BACKUP_MAX_AGE=
-export SDTD_BACKUP_COMPRESS=none
 
 # User account and group to run the server
@@ -35,8 +17,59 @@
 export SDTD_GROUP=sdtd
 
+# World to load
+export SDTD_WORLD=Navezgane
+
+# Name of savegame to load
+export SDTD_SAVE=a7
+
+# Base port to use for networking
+# Note that baseport (UDP) and base+1 up to base+3 (each TCP) will be used
+export SDTD_PORT=25000
+
+# Set this to a reasonable value to get notified if the engine uses up too much RAM
+# Value in mebibytes (MiB)
+# For a server only used for 7dtd this should be ~500 MiB lower than the machines total RAM
+export MEM_NOTIFY_MAX_RAM=2500
+
+# If limit exceeded notify someone by email?
+export MEM_NOTIFY_MAIL=no
+
+# If limit exceeded notify someone by XMPP (aka Jabber)?
+export MEM_NOTIFY_XMPP=yes
+
+# XMPP user to use for sending
+export XMPP_USER=
+# XMPP server for sending
+export XMPP_SERVER=
+# XMPP account password
+export XMPP_PASSWORD=
+# Receiver of message
+export XMPP_TARGET=
+
+# Mail from field
+export MAIL_FROM=
+# Mail receiver
+export MAIL_TO=
+# Subject of mail
+export MAIL_SUBJECT=7dtd memory usage
+# SMTP server to use for sending
+export MAIL_SMTP=
+# SMTP user (not used if empty)
+export MAIL_USER=
+# SMTP password (not used if empty)
+export MAIL_PASS=
+
 # Paths to binaries. Use "which BINARYNAME" to find the path of a single binary
+export CP=/bin/cp
 export RSYNC=/usr/bin/rsync
-export XMLSTARLET=/usr/bin/xmlstarlet
-export PKILL=/usr/bin/pkill
-export SSD=/usr/local/lib/7dtd/start-stop-daemon/start-stop-daemon
-export EDITOR=/usr/bin/editor
+export DU=/usr/bin/du
+export FREE=/usr/bin/free
+export AWK=/usr/bin/awk
+export PIDOF=/bin/pidof
+export WINE=/usr/bin/wine
+
+if [ -e $SDTD_SERVERCONFIG ]; then
+	export SDTD_TELNET_ENABLED=`xmllint --xpath "string(/ServerSettings/property[@name='TelnetEnabled']/@value)" $SDTD_SERVERCONFIG`
+	export SDTD_TELNET_PORT=`xmllint --xpath "string(/ServerSettings/property[@name='TelnetPort']/@value)" $SDTD_SERVERCONFIG`
+	export SDTD_TELNET_PASSWORD=`xmllint --xpath "string(/ServerSettings/property[@name='TelnetPassword']/@value)" $SDTD_SERVERCONFIG`
+fi
Index: /scripts/etc/init.d/7dtd.sh
===================================================================
--- /scripts/etc/init.d/7dtd.sh	(revision 505)
+++ /scripts/etc/init.d/7dtd.sh	(revision 1)
@@ -13,28 +13,68 @@
 ### END INIT INFO
 
-#   Copyright 2016 Christian 'Alloc' Illy
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
+. /etc/7dtd.conf
 
+NAME="7DtD"
+SCREENREF="sdtd"
+BINARYPATH=$SDTD_ROOT
+USER=$SDTD_USER
+RUNTIME=$WINE
+BINARYNAME=7DaysToDie.exe
+PIDFILE="7dtd-server.pid"
+
+OPTS="-quit -batchmode -nographics -configfile=../serverconfig.xml -dedicated"
+
+cd "$BINARYPATH"
 
 case "$1" in
     start)
-    	/usr/local/bin/7dtd.sh start "!"
+        echo -n "Starting the $NAME server... "
+        if [ ! `pgrep Xvfb` ]; then
+        	su -c "/usr/bin/Xvfb :1 -screen 0 640x480x16" sdtd &
+        	sleep 3
+        fi
+	if [ -e "$BINARYNAME" ]; then
+	    if [ `pgrep $BINARYNAME` ]; then
+	        echo "Already running!"
+	    else
+	    	export DISPLAY=localhost:1.0
+                start-stop-daemon --start --pidfile $SDTD_ROOT/$PIDFILE --background --make-pidfile --chuid $USER --user $USER --chdir $BINARYPATH --exec "/usr/bin/screen" -- -D -m -S $SCREENREF $RUNTIME $BINARYPATH/$BINARYNAME $OPTS
+                sleep 1
+            fi
+        else
+            echo "Could not find binary, aborting!"
+            exit 5
+        fi
+        if [ `pgrep -F $SDTD_ROOT/$PIDFILE` ]; then
+            echo "Done!"
+        else
+            echo "Failed!"
+            rm -f $SDTD_ROOT/$PIDFILE
+        fi
     ;;
     stop)
-    	/usr/local/bin/7dtd.sh kill "!"
+    	start-stop-daemon --status --pidfile $SDTD_ROOT/$PIDFILE
+        if [ $? -eq 0 ]; then
+            echo -n "Stopping the $NAME server... "
+            if [ "$SDTD_TELNET_ENABLED" = "true" ] && [ -n "$SDTD_TELNET_PASSWORD" ]; then
+                echo "$SDTD_TELNET_PASSWORD\nshutdown" | nc -q 2 127.0.0.1 $SDTD_TELNET_PORT
+                sleep 5
+            else
+                echo "Telnet not enabled or no password set. No graceful shutdown!"
+            fi
+            start-stop-daemon --stop --pidfile $SDTD_ROOT/$PIDFILE
+            rm $SDTD_ROOT/$PIDFILE
+            echo "Done!"
+        else
+            echo "$NAME not running"
+        fi
     ;;
     status)
-    	/usr/local/bin/7dtd.sh instances
+    	start-stop-daemon --status --pidfile $SDTD_ROOT/$PIDFILE
+        if [ $? -eq 0 ]; then
+            echo "$NAME server is running"
+        else
+            echo "$NAME server not running"
+        fi
     ;;
     *)
Index: /scripts/home/sdtd/.screenrc
===================================================================
--- /scripts/home/sdtd/.screenrc	(revision 1)
+++ /scripts/home/sdtd/.screenrc	(revision 1)
@@ -0,0 +1,3 @@
+multiuser on
+acladd root
+
Index: /scripts/usr/local/bin/7dtd-backup.sh
===================================================================
--- /scripts/usr/local/bin/7dtd-backup.sh	(revision 1)
+++ /scripts/usr/local/bin/7dtd-backup.sh	(revision 1)
@@ -0,0 +1,23 @@
+#!/bin/bash
+. /etc/7dtd.conf
+
+DT=`date "+%Y-%m-%d_%H-%M"`
+NewBackup=$SDTD_BACKUP_ROOT/$DT
+
+# Check for backup folder existence
+if [ -e $SDTD_BACKUP_ROOT ]; then
+	# Exists, copy(link) latest backup
+	unset -v LatestBackup
+	for file in "$SDTD_BACKUP_ROOT"/*; do
+		[[ $file -nt $LatestBackup ]] && LatestBackup=$file
+	done
+	$CP -al $LatestBackup $NewBackup
+else
+	# Create new backup dir
+	mkdir $SDTD_BACKUP_ROOT
+fi
+
+$RSYNC -a --delete --numeric-ids --delete-excluded $SDTD_ROOT/Data/Worlds/./ $NewBackup
+touch $NewBackup
+
+#echo "Backup folder disk usage: `$DU -sh $SDTD_BACKUP_ROOT`"
Index: /scripts/usr/local/bin/7dtd-check_mem.sh
===================================================================
--- /scripts/usr/local/bin/7dtd-check_mem.sh	(revision 1)
+++ /scripts/usr/local/bin/7dtd-check_mem.sh	(revision 1)
@@ -0,0 +1,36 @@
+#!/bin/bash
+. /etc/7dtd.conf
+
+if [[ "$MEM_NOTIFY_XMPP" = "no" ]]; then
+	if [[ "$MEM_NOTIFY_MAIL" = "no" ]]; then
+		exit
+	fi
+fi
+
+PID=`$PIDOF 7DaysToDie.exe`
+
+if [[ -z "$PID" ]]; then
+	exit 0
+fi
+
+USED_CUR_MB=`$FREE -m | $AWK '/buffers\/cache/{print $3;}'`
+#USED_CUR_MB=`cat /proc/$PID/status | $AWK '/VmRSS/{print int($2/1024);}'`
+TELNETPORT=$(($SDTD_PORT + 3))
+#USED_CHUNKS=`echo -e "cc" | nc -q 3 127.0.0.1 $TELNETPORT | grep -a Mem | awk '/Chunk/{print $3;}'`
+
+if [ "$USED_CUR_MB" -gt "$MEM_NOTIFY_MAX_RAM" ]
+then
+	MESSAGE="7dtd: $USED_CUR_MB MiB of memory used! Chunk memory: $USED_CHUNKS"
+	if [[ "$MEM_NOTIFY_XMPP" = "yes" ]]; then
+		echo $MESSAGE | sendxmpp -u $XMPP_USER -p $XMPP_PASSWORD -j $XMPP_SERVER -t $XMPP_TARGET
+	fi
+	if [[ "$MEM_NOTIFY_MAIL" = "yes" ]]; then
+		if [[ -n "$MAIL_USER" ]]; then
+			userparam="-xu $MAIL_USER"
+		fi
+		if [[ -n "$MAIL_PASS" ]]; then
+			passparam="-xp $MAIL_PASS"
+		fi
+		sendEmail -q -f $MAIL_FROM -t $MAIL_TO -u "$MAIL_SUBJECT" -m "$MESSAGE" -s $MAIL_SMTP $userparam $passparam
+	fi
+fi
Index: /scripts/usr/local/bin/7dtd-kill.sh
===================================================================
--- /scripts/usr/local/bin/7dtd-kill.sh	(revision 1)
+++ /scripts/usr/local/bin/7dtd-kill.sh	(revision 1)
@@ -0,0 +1,2 @@
+#!/bin/bash
+/etc/init.d/7dtd.sh stop
Index: /scripts/usr/local/bin/7dtd-start.sh
===================================================================
--- /scripts/usr/local/bin/7dtd-start.sh	(revision 1)
+++ /scripts/usr/local/bin/7dtd-start.sh	(revision 1)
@@ -0,0 +1,2 @@
+#!/bin/bash
+/etc/init.d/7dtd.sh start
Index: /scripts/usr/local/bin/7dtd-update.sh
===================================================================
--- /scripts/usr/local/bin/7dtd-update.sh	(revision 1)
+++ /scripts/usr/local/bin/7dtd-update.sh	(revision 1)
@@ -0,0 +1,21 @@
+#!/bin/bash
+. /etc/7dtd.conf
+
+if [ ! -e $STEAMCMD_ROOT ]; then
+	mkdir $STEAMCMD_ROOT
+	cd /tmp
+	wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
+	tar -xvzf steamcmd_linux.tar.gz -C $STEAMCMD_ROOT
+	cd $STEAMCMD_ROOT
+	./steamcmd.sh +quit
+fi
+
+cd $STEAMCMD_ROOT
+
+./steamcmd.sh +@sSteamCmdForcePlatformType windows +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_ROOT +app_update 251570 validate +quit
+chown $SDTD_USER.$SDTD_GROUP -R $SDTD_ROOT
+
+cp $SDTD_ROOT/Install/32bit/7DaysToDie.exe $SDTD_ROOT/
+cp $SDTD_ROOT/Install/32bit/mono.dll $SDTD_ROOT/7DaysToDie_Data/Mono/
+cp $SDTD_ROOT/Install/32bit/SteamworksManaged.dll $SDTD_ROOT/7DaysToDie_Data/Managed/
+cp $SDTD_ROOT/../msvcr100.dll $SDTD_ROOT/
Index: ripts/usr/local/bin/7dtd.sh
===================================================================
--- /scripts/usr/local/bin/7dtd.sh	(revision 505)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#!/bin/bash
-
-#   Copyright 2016 Christian 'Alloc' Illy
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-
-
-. /usr/local/lib/7dtd/common.sh
-checkRootLoadConf
-
-if [ -z $1 ]; then
-	genericHelp
-else
-	CMD=$(camelcasePrep "$1")
-	shift
-	
-	if [ "$CMD" = "Help" ]; then
-		if [ -z $1 ]; then
-			genericHelp
-		else
-			HELPCMD=$(camelcasePrep "$1")
-			if [ "$(type -t sdtdCommand${HELPCMD}Help)" = "function" ]; then
-				sdtdCommand${HELPCMD}Help
-			else
-				echo "Command \"$1\" does not exist!"
-				exit 1
-			fi
-		fi
-	else
-		if [ "$(type -t sdtdCommand${CMD})" = "function" ]; then
-			sdtdCommand${CMD} "$@"
-		else
-			echo "Command \"$CMD\" does not exist!"
-			exit 1
-		fi
-	fi
-fi
-
-exit 0
-
