attach
attach
Attaches to subcommands that were started using asadmin --detach or
that contain progress information
Description
The attach subcommand attaches to subcommands that were started using
the asadmin utility option --detach or that contain progress
information. The --detach option detaches long-running subcommands and
executes them in the background in detach mode.
Job IDs are assigned to the subcommands (jobs), and can be used to view
the status of a job and its output. Use the
list-jobs(1) subcommand to view the
jobs and their job IDs, and the
configure-managed-jobs(1)
subcommand to configure how long information about the jobs is kept.
This subcommand is supported in remote mode only.
Options
- asadmin-options
-
Options for the
asadminutility. For information about these options, see theasadmin(1M) help page. --help-?-
Displays the help text for the subcommand.
--timeout-
Specifies timeout in seconds to evaluate the expected result. If the timeout is exceeded, the command fails - however it does not mean it did not make any changes. The job status is unknown in such case.
Examples
Example 1 Attaching to a Subcommand and Checking Its Status
This example attaches to the deploy subcommand with a job ID of 20
and shows that the job is finished. If a subcommand is still in
progress, the output displays the current status, for example,
64%: Uploading bits.
asadmin> attach 20
Finished execution of deploy
Command attach executed successfully.
Example 2 Usage in scripts
This example deploys an ear file while we continue configuring the domain.
Then attaches to the deploy subcommand and shows that the job is finished.
As showing progress is not useful in scripts, we use --terse to wait
for the result.
Note: Don’t execute it on command line, failure would exit your active shell!
#!/bin/bash
set -e
jobid=$(asadmin --terse --detach deploy ./application.ear)
echo $jobid
1
# Here you can add other commands
asadmin ...
result="$(asadmin --terse attach ${jobid})"
if [[ $result =~ "FAILURE" ]]; then
echo "${result}"
exit 1;
fi