Index: scripts/usr/local/bin/7dtd-backup.sh
===================================================================
--- scripts/usr/local/bin/7dtd-backup.sh	(revision 13)
+++ scripts/usr/local/bin/7dtd-backup.sh	(revision 14)
@@ -1,4 +1,4 @@
 #!/bin/bash
-# Version 1
+# Version 3
 . /etc/7dtd.conf
 
Index: scripts/usr/local/bin/7dtd-common.sh
===================================================================
--- scripts/usr/local/bin/7dtd-common.sh	(revision 13)
+++ scripts/usr/local/bin/7dtd-common.sh	(revision 14)
@@ -1,4 +1,4 @@
 #!/bin/bash
-# Version 2
+# Version 3
 
 # Provides common functions for 7dtd-scripts. Not intended to be run directly.
@@ -23,15 +23,35 @@
 
 # Check if the given instance name is an existing instance
-# On failure exit the script!
 # Params:
 #   1: Instance name
-checkInstance() {
+# Returns:
+#   0/1 instance not valid/valid
+isValidInstance() {
 	if [ -z $1 ]; then
-		echo "No instance given!"
-		exit 2
+		echo 0
+	else
+		if [ ! -d $(getInstancePath $1) ]; then
+			echo 0
+		else
+			if [ ! -f $(getInstancePath $1)/config.xml ]; then
+				echo 0
+			else
+				echo 1
+			fi
+		fi
 	fi
-	if [ ! -d $(getInstancePath $1) ]; then
-		echo "Instance $1 does not exist!"
-		exit 3
+}
+
+# Check if the given instance is valid, exit the script otherwise
+# Params:
+#   1: instance name
+checkInstanceValid() {
+	if [ -z $1 ]; then
+		echo "Missing parameter <instance>"
+		exit 1
+	fi
+	if [ $(isValidInstance $1) -eq 0 ]; then
+		echo "'$1' is not a valid instance"
+		exit 1
 	fi
 }
@@ -50,4 +70,16 @@
 		echo 0
 	fi
+}
+
+# Get list of defined instances
+# Returns:
+#   List of instances
+getInstanceList() {
+	for IF in $SDTD_BASE/instances/*; do
+		I=`basename $IF`
+		if [ $(isValidInstance $I) -eq 1 ]; then
+			echo $I
+		fi
+	done
 }
 
@@ -74,6 +106,6 @@
 #   Property value
 getConfigValue() {
-	CONF=$(getInstancePath $1)/serverconfig.xml
-	xmllint --xpath "string(/ServerSettings/property[@name='$2']/@value)" $CONF
+	CONF=$(getInstancePath $1)/config.xml
+	xmlstarlet sel -t -v "/ServerSettings/property[@name='$2']/@value" $CONF
 }
 
Index: scripts/usr/local/bin/7dtd-instances.sh
===================================================================
--- scripts/usr/local/bin/7dtd-instances.sh	(revision 13)
+++ scripts/usr/local/bin/7dtd-instances.sh	(revision 14)
@@ -1,4 +1,4 @@
 #!/bin/bash
-# Version 2
+# Version 3
 
 # Lists available 7dtd instances.
@@ -13,20 +13,19 @@
 	printf -v line "%*s-+-%*s-+-%*s-+-%*s\n" 20 " " 8 " " 7 " " 5 " "
 	echo ${line// /-}
-	for I in $SDTD_BASE/instances/*; do
-		ins=`basename $I`
-		run=$(isRunning $ins)
+	for I in $(getInstanceList); do
+		run=$(isRunning $I)
 		if [ $run -eq 1 ]; then
 			run="yes"
-			tel=$(telnetCommand $ins lp)
+			tel=$(telnetCommand $I lp)
 			cur=`echo $tel | sed "s/\r/\n/g" | sed "s/^ //g" | grep "Total of " | cut -d\  -f 3`
 		else
 			run="no"
-			cur=0
+			cur="-"
 		fi
 
-		max=$(getConfigValue $ins ServerMaxPlayerCount)
-		port=$(getConfigValue $ins ServerPort)
+		max=$(getConfigValue $I ServerMaxPlayerCount)
+		port=$(getConfigValue $I ServerPort)
 
-		printf "%-*s | %*s |   %2d/%2d | %5d\n" 20 "$ins" 8 "$run" $cur $max $port
+		printf "%-*s | %*s |   %2s/%2d | %5d\n" 20 "$I" 8 "$run" $cur $max $port
 	done
 	exit 0
@@ -34,9 +33,5 @@
 
 showInfo() {
-	if [ -z $1 ]; then
-		echo "Missing parameter <instance>"
-		exit 1
-	fi
-	checkInstance $1
+	checkInstanceValid $1
 
 	line() {
Index: scripts/usr/local/bin/7dtd-kill.sh
===================================================================
--- scripts/usr/local/bin/7dtd-kill.sh	(revision 13)
+++ scripts/usr/local/bin/7dtd-kill.sh	(revision 14)
@@ -1,4 +1,4 @@
 #!/bin/bash
-# Version 1
+# Version 3
 
 # Tries to stop the 7dtd instance given as first parameter.
@@ -12,12 +12,22 @@
 checkRootLoadConf
 
-checkInstance $1
+checkInstanceValid $1
 
 res=$(isRunning $1)
 if [ $res -eq 1 ]; then
-	telnetCommand $1 shutdown
-	sleep 1
-	res=$(isRunning $1)
-	if [ $res -eq 1 ]; then
+	echo "Trying to gracefully shutdown..."
+	tmp=$(telnetCommand $1 shutdown)
+	echo "Waiting for server to shut down..."
+	
+	waittime=0
+	maxwait=5
+	until [ $(isRunning $1) -eq 0 ] || [ $waittime -eq $maxwait ]; do
+		(( waittime++ ))
+		sleep 1
+		echo $waittime/$maxwait
+	done
+	
+	if [ $(isRunning $1) -eq 1 ]; then
+		echo "Failed, force closing server..."
 		start-stop-daemon --stop --pidfile $(getInstancePath $1)/7dtd.pid
 	fi
Index: scripts/usr/local/bin/7dtd-running.sh
===================================================================
--- scripts/usr/local/bin/7dtd-running.sh	(revision 13)
+++ scripts/usr/local/bin/7dtd-running.sh	(revision 14)
@@ -1,4 +1,4 @@
 #!/bin/bash
-# Version 1
+# Version 3
 
 # Checks if the 7dtd instance given as first parameter is running.
@@ -12,5 +12,5 @@
 checkRootLoadConf
 
-checkInstance $1
+checkInstanceValid $1
 
 res=$(isRunning $1)
Index: scripts/usr/local/bin/7dtd-start.sh
===================================================================
--- scripts/usr/local/bin/7dtd-start.sh	(revision 13)
+++ scripts/usr/local/bin/7dtd-start.sh	(revision 14)
@@ -1,4 +1,4 @@
 #!/bin/bash
-# Version 1
+# Version 3
 
 # Tries to start the 7dtd instance given as first parameter.
@@ -13,5 +13,5 @@
 checkRootLoadConf
 
-checkInstance $1
+checkInstanceValid $1
 
 res=$(isRunning $1)
@@ -27,5 +27,5 @@
 	SSD_DAEMON="--background --no-close"
 	SSD_USER="--chuid $SDTD_USER:$SDTD_GROUP --user $SDTD_USER"
-	OPTS="-quit -batchmode -nographics -configfile=$(getInstancePath $1)/serverconfig.xml -dedicated"
+	OPTS="-quit -batchmode -nographics -configfile=$(getInstancePath $1)/config.xml -dedicated"
 	
 	start-stop-daemon --start $SSD_PID $SSD_DAEMON $SSD_USER --chdir $SDTD_ROOT --exec $WINE -- $SDTD_ROOT/7DaysToDie.exe $OPTS > $(getInstancePath $1)/stdout.log 2>&1
Index: scripts/usr/local/bin/7dtd-update.sh
===================================================================
--- scripts/usr/local/bin/7dtd-update.sh	(revision 13)
+++ scripts/usr/local/bin/7dtd-update.sh	(revision 14)
@@ -1,4 +1,4 @@
 #!/bin/bash
-# Version 1
+# Version 3
 
 . /usr/local/bin/7dtd-common.sh
