Currently when an update is made to the configuration, we copy the config file to ".lastknowngood" and write a new version. We need something more sophisticated than that.
1) The original version of present on server start should be saved as .original.
2) We should keep a proper versioned history (standalone.xml.v1, standalone.xml.v2 etc)
3) Keep a standalone.xml.last which is the same as the current standalone.xml. This can be used to detect (via file timestamps) changes to standalone.xml made while the server is offline – such change results in a new .original.
4) We need to create proper semantics for the ".lastknowngood" notion, or scrap it. Right now it's just the previous version of the file, which may or may not have been "good".