Backing up your configuration file via the CLI

In this recipe, we will learn how to backup our configuration via the CLI. Essentially, the CLI backs up the standalone.xml file by copying it into the snapshot.

Getting ready

Start up your WildFly so that we can directly connect to it via the CLI, as follows:

$ cd ~/WFC/wildfly
$ ./bin/standalone.sh

How to do it…

The command itself is pretty easy:

$ ./bin/jboss-cli.sh --connect
[standalone@localhost:9990 /] :take-snapshot  
{
    "outcome" => "success",
    "result" => "/home/luigi/WFC/wildfly/standalone/configuration/standalone_xml_history/snapshot/20150301-165737562standalone.xml"
}

That's it! A backup of the standalone.xml file gets copied into the snapshot folder, named by prefixing the file with the current date and time.

Tip

Always back up your configuration, especially when operating in a production environment.