2.11 Running Tasks in the Background
The BACKGROUND
command runs the SQLcl command as a
background task.
Syntax
background|bg {OPTIONS} <commandspec>
where <commandspec> is the SQLcl command.
Options
Option | Description |
---|---|
-wait4|-w4 <wait4> | List of task names to wait for. See Wait4 Command |
-taskname|-tn <taskname> |
Name of the task. To know the task details, use the Jobs Command. |
SQL> background apex list
SQL> background -taskname task3 -wait4 task1,task2 apex list
2.11.1 Jobs Command
The JOBS
command lists the details of jobs that are
running in the background.
Syntax
jobs|jb {SUBCOMMAND} {OPTIONS}
where SUBCOMMAND can be any of the following:
Options
Option | Description |
---|---|
-id|-i <id> | The id of the task. |
-taskname|-tn <taskname> | Name of the task. |
SQL> jobs -id 2
SQL> jobs logs -id 2
SQL> jobs cancel -id 2
2.11.1.1 Cancel Jobs
This command cancels a running job.
Syntax
jobs|jb cancel|c {OPTIONS}
Options
Option | Description |
---|---|
-id|-i <id> | The id of the task. |
-taskname|-tn <taskname> | Name of the task. |
SQL> jobs cancel -id 2
2.11.1.2 Log Jobs
This command shows the log files for jobs.
Syntax
jobs|jb logs|l {SUBCOMMAND} {OPTIONS}
where SUBCOMMAND is:
delete|d
: Delete logfiles for completed jobs.
Options
Option | Description |
---|---|
-id|-i <id> | The id of the task. |
-taskname|-tn <taskname> | Name of the task. |
SQL> jobs logs -id 2
SQL> jobs logs delete
2.11.1.3 Delete Jobs
This command removes jobs from the list. This could be either a a specific job, or all jobs, or only if the job is finished.
Syntax
jobs|jb delete|d {OPTIONS}
Options
Option | Description |
---|---|
-id|-i <id> | The id of the task. |
-taskname|-tn <taskname> | Name of the task. |
-all|-a | Remove all tasks from the list. |
-finished|-f | Only remove finished tasks from the list. |
SQL> jobs delete -id 2
2.11.2 Wait4 Command
Wait for one or more tasks to finish before continuing the job.
Syntax
wait4|w4 {OPTIONS} {PARAMETERS}
Options
Option | Description |
---|---|
-delay|-d <delay> (0) | Number of milliseconds to wait before continuing with processing. |
Parameters
Option | Description |
---|---|
<tasknames> | List of task names to wait for. |
SQL> wait4 task1,task3