Index: scripts/etc/7dtd.conf
===================================================================
--- scripts/etc/7dtd.conf	(revision 7)
+++ scripts/etc/7dtd.conf	(revision 9)
@@ -8,5 +8,7 @@
 # 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 "instances" folder
+export SDTD_BASE=/home/sdtd
 
 # Root directory for backups
@@ -16,47 +18,4 @@
 export SDTD_USER=sdtd
 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
@@ -68,8 +27,2 @@
 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 7)
+++ scripts/etc/init.d/7dtd.sh	(revision 9)
@@ -13,67 +13,30 @@
 ### END INIT INFO
 
-. /etc/7dtd.conf
-
-NAME="7DtD"
-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"
+. /usr/local/bin/7dtd-common.sh
+checkRootLoadConf
 
 case "$1" in
     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 --no-close --make-pidfile --chuid $USER --user $USER --chdir $BINARYPATH --exec  -- -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
+    	echo "Starting all 7dtd instances:"
+        for I in $SDTD_BASE/instances/*; do
+            ins=`basename $I`
+            echo "Starting: $ins"
+            /usr/local/bin/7dtd-start.sh $ins
+        done
+        echo "All done"
     ;;
     stop)
-    	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
+    	echo "Stopping all 7dtd instances:"
+        for I in $SDTD_BASE/instances/*; do
+            ins=`basename $I`
+            echo "Stopping: $ins"
+            /usr/local/bin/7dtd-kill.sh $ins
+            echo
+            echo
+        done
+        echo "All done"
     ;;
     status)
-    	start-stop-daemon --status --pidfile $SDTD_ROOT/$PIDFILE
-        if [ $? -eq 0 ]; then
-            echo "$NAME server is running"
-        else
-            echo "$NAME server not running"
-        fi
+        /usr/local/bin/7dtd-instances.sh
     ;;
     *)
