Sun GlassFish Enterprise Server v3 Administration Guide

ProcedureTo Run a Set of asadmin Subcommands From a File

Running a set of asadmin subcommands from a file enables you to automate repetitive tasks.

  1. Create a plain text file that contains the sequence of subcommands that you want to run.

  2. Run the multimode(1) subcommand, specifying the file that you created.

    If necessary, also specify any asadmin utility options that are required to enable subcommands in the file to run.

Example 2–9 Running a Set of asadmin Subcommands From a File

This example contains the following:

The commands_file.txt file contains the asadmin utility subcommands to perform the following sequence of operations:

  1. Creating the domain customdomain

  2. Starting the domain customdomain

  3. Listing all available subcommands

  4. Stopping the domain customdomain

  5. Deleting the domain customdomain

The content of the commands_file.txt file is as follows:

create-domain --portbase 9000 customdomain
start-domain customdomain
stop-domain customdomain
delete-domain customdomain

This example runs the sequence of subcommands in the commands_file.txt file. Because the --portbase option is specified for the create-domain subcommand in the file, the --port asadmin utility option must also be set.

asadmin --port 9048 multimode --file commands_file.txt

See Also

For more information about the subcommands in the preceding example, see the following help pages: