When the job is executing in the foreground, for example, directly executing the command `trace Test t`, or executing the background job command `trace Test t &`, then putting the job back to the foreground via `fg` command, the console cannot continue to execute other command, but can receive and process the following keyboard events:
-‘ctrl + z’: Suspends the job, the job status will change to `Stopped`, and the job can be restarted by `bg <job-id>` or `fg <job-id>`
-‘ctrl + c’: Stops the job
-‘ctrl + d’: According to linux semantics this should lead to exit the terminal, right now Arthas has not implemented this yet, therefore simply ignore this keystroke.
- When a job is executed in the background or in suspended status (use `ctrl + z` to suspend job), `fg <job-id>` can transfer the job to the foreground to continue to run.
- When a job is in suspended status (use `ctrl + z` to suspend job), `bg <job-id>` can put the job to the background to continue to run.
- A job created by other session can only be put to the foreground to run by using `fg` in the current session.
The job output can be redirect to the specified file by `>` or `>>`, and can be used together with `&`. By doing this, you can achieve running commands asynchronously, for example:
At this time, the trace command will be executed in the background, and the result will be output to the `test.out` file under the `working directory` of the application. You can continue to execute other commands. And you can view the command execution result in the file. You can execute the `pwd` command to view the `working directory` of the current application.
At this time, the command will be executed asynchronously in the background, and the result will be asynchronously saved in the file (`~/logs/arthas-cache/${PID}/${JobId}`);
- At this time, the execution of the task is not affected by the session disconnection; the default timeout period of the task is 1 day, and the default timeout period can be modified through the global `options` command;
- The result of this command will be output asynchronously to the file; at this time, regardless of whether `save-result` is true or not, the result will not be written asynchronously to `~/logs/arthas-cache/result.log`.
- Support up to 8 commands at the same time to redirect the output to the log files.
- Do not open too many background jobs at the same time to avoid negative performance effect to the target JVM.
- If you do not want to stop the Arthas service and continue to perform background tasks, you can exit the Arthas console by executing `quit` command (`stop` command will stop the Arthas service)