Index: /main/trunk/greenstone3/resources/java/server.properties
===================================================================
--- /main/trunk/greenstone3/resources/java/server.properties	(revision 24454)
+++ /main/trunk/greenstone3/resources/java/server.properties	(revision 24455)
@@ -17,5 +17,5 @@
 
 ServerSettings.Title=Server settings
-ServerSettings.Auto_Start=Enter the library automatically
+ServerSettings.Auto_Start=Enter the library automatically on startup
 ServerSettings.Keep_Port=Do not modify port
 ServerSettings.OK=OK
Index: /main/trunk/greenstone3/src/java/org/greenstone/server/BaseServer.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/server/BaseServer.java	(revision 24454)
+++ /main/trunk/greenstone3/src/java/org/greenstone/server/BaseServer.java	(revision 24455)
@@ -64,5 +64,5 @@
 	
 	config_properties = new Properties();
-	reloadConfigProperties();
+	reloadConfigProperties(true); // first time starting the server, work out port_number
 
 	dictionary = new Dictionary("server", lang, this.getClass().getClassLoader());	
@@ -250,5 +250,5 @@
     }
     
-    public  void reloadConfigProperties() {
+    public  void reloadConfigProperties(boolean port_has_changed) {
 	try {
 	    FileInputStream in = new FileInputStream(config_properties_file);
Index: /main/trunk/greenstone3/src/java/org/greenstone/server/BaseServerSettings.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/server/BaseServerSettings.java	(revision 24454)
+++ /main/trunk/greenstone3/src/java/org/greenstone/server/BaseServerSettings.java	(revision 24455)
@@ -234,9 +234,11 @@
 	    // save everything to config_properties if things have changed
 	    boolean has_changed = false;
-            boolean require_restart = false;
+		boolean require_restart = false;
+		boolean port_has_changed = false;
 
 	    if (portNum != ((Integer)portNumber_spinner.getValue()).intValue()) {
-		has_changed = true;
-                require_restart = true;
+			port_has_changed = true;
+			has_changed = true;
+			require_restart = true;
                 server.reconfigRequired();
                 portNum = ((Integer)portNumber_spinner.getValue()).intValue();
@@ -295,5 +297,5 @@
 		scriptReadWrite.writeOutFile(BaseServer.config_properties_file, newFileLines);
 
-		server.reloadConfigProperties();
+		server.reloadConfigProperties(port_has_changed);
 		server.reload(); // work out the URL again in case it has changed
 		if (require_restart){
Index: /main/trunk/greenstone3/src/java/org/greenstone/server/Server2.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/server/Server2.java	(revision 24454)
+++ /main/trunk/greenstone3/src/java/org/greenstone/server/Server2.java	(revision 24455)
@@ -292,17 +292,20 @@
     }
 
-    public void reloadConfigProperties() {
-	super.reloadConfigProperties();
+    public void reloadConfigProperties(boolean port_has_changed) {
+	super.reloadConfigProperties(port_has_changed);
 
 	// make sure the port is okay, otherwise find another port
 	// first choice is port 80, second choice starts at 8282
 	String port = config_properties.getProperty("portnumber", "80");
-	String keepport = config_properties.getProperty("keepport", "0"); // default is to not try to keep the same port
+	String keepport = config_properties.getProperty("keepport", "0"); // default is to not try to force the same port if in use by other servers
 
 	int portDefault = 8282;
 	try {
-	    int portNum = Integer.parseInt(port);
-	    boolean verbose = true;
-	    if(!PortFinder.isPortAvailable(portNum, verbose)) { // first time, print any Port Unavailable messages
+	  int portNum = Integer.parseInt(port);
+	  boolean verbose = true;
+	  if(port_has_changed) { // this is the test that prevents the server from arbitrarily shifting the port. 
+							// only check at configured port if it's not the current port (the port we
+							// are still running on), because that will always be in use and unavailable.
+		if(!PortFinder.isPortAvailable(portNum, verbose)) { // first time, print any Port Unavailable messages
 		if(keepport.equals("1")) {
 		    String errorMsg = "Unable to run the Greenstone server on port " + port + ". It may already be in use.";
@@ -311,6 +314,6 @@
 		    System.err.println("If you wish to try another port, go to File > Settings of the Greenstone Server interface and either change the port number or untick the \"Do Not Modify Port\" option there. Then press the \"Enter Library\" button.");
 		    System.err.println("******************\n");
-		} else {
-
+		} else { // can modify port, try to find a new port
+		
 		    PortFinder portFinder = new PortFinder(portDefault, 101);
 		    // Search for a free port silently from now on--don't want more
@@ -336,5 +339,6 @@
 		    System.err.println("Running server on port " + port + ".");
 		}
-	    }    
+	    }
+	  }	
 	} catch (Exception e) {
 	    recordError("Exception in Server2.reload(): " + e.getMessage());
