CLI: Jobs
On This Page
- 1 Jobs
- 1.1 List Jobs
- 1.2 Show a Job
- 1.3 Create a Job
- 1.4 Clone a Job
- 1.5 Start Job(s)
- 1.6 Pause Job(s)
- 1.7 Delete a Job
- 1.8 Job Items
- 1.9 Job Folders
- 1.10 Job Security Mappings
- 1.11 Audit Job(s)
- 1.12 Report Job History
- 1.12.1 Example 1: Produce a history report for all jobs
- 1.12.2 Example 2: Produce a history report for a specific job
- 1.12.3 Example 3: Produce a history report for a specific job in CSV format
- 1.12.4 Example 4: Produce a history report for a specific execution of a specific job
- 1.12.5 Example 5: Produce a history report for the last execution of a specific job
- 1.12.6 Example 6: Produce a history report for the current execution of a specific job
The CLI references “skysync.” This is expected.
Jobs
List Jobs
parameter | description | required | default |
---|---|---|---|
kind | Job Kind | optional |
|
search, q | Search text | optional |
|
status | Search by the current job status (idle, start, running, paused) | optional |
|
parent | Search by the parent job ID | optional |
|
node | Search by the currently executing node address | optional |
|
active | Only retrieve active jobs | optional |
|
offset | Search offset | optional | 0 |
limit | Search page size | optional | 20 |
Example 1: List all the jobs
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
skysync-cli jobs list
Expected results
ID Name Discriminator Kind Enabled Status
delete_jobs Delete Pending Jobs system true idle
job_retention_policy Apply Job Retention Policies system true idle
4ef88eeda7904b8e9d542439a24c232d My Job 1 folder_mapping true idle
887622dea68c4189aa69d83c376c5b50 My Job 1 folder1 transfer true idle
Example results (JSON)
[
{
"id": "delete_jobs",
"name": "Delete Pending Jobs",
"discriminator": "",
"kind": "system",
"disabled": false,
"status": "idle"
},
{
"id": "job_retention_policy",
"name": "Apply Job Retention Policies",
"discriminator": "",
"kind": "system",
"disabled": false,
"status": "idle"
},
{
"id": "4ef88eeda7904b8e9d542439a24c232d",
"name": "My Job 1",
"discriminator": "",
"kind": "folder_mapping",
"disabled": false,
"status: "idle"
},
{
"id": "887622dea68c4189aa69d83c376c5b50",
"name": "My Job 1",
"discriminator": "folder1",
"kind": "transfer",
"disabled": false,
"status: "idle"
}
]
Example 2: List transfer jobs
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
Example 3: List active jobs
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
Example 4: List jobs with "test" in their name
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
Command
Example 5: List the jobs skipping the first 5
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
Example 6: List running jobs
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
Show a Job
This command will show the details of the specified job.
parameter | description | required | default |
---|---|---|---|
id | The ID of the job for which details will be shown | required |
|
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
Command with example values
Example results
Example results (JSON)
If the ID entered does not correspond to an existing job, for example, if the job was already deleted, the expected output is the following.
Expected results
Expected results (JSON)
Create a Job
This command will create a job.
parameter | description | required | default |
---|---|---|---|
kind | The job kind | optional | transfer |
name | The job name | optional |
|
wizard, prompt | A flag to indicate a desire to run through the new-job wizard | optional | true |
auto | Schedule the job as automatic | optional | true |
manual | Schedule the job as manual | optional | false |
job-input, in | Read JSON job from stdin |
|
|
job-file, file | The job JSON file |
|
|
If both auto and manual are set to true, the job will be created to run manually.
To create a job that imports permissions or metadata or performs user-drive mapping, use the below examples in conjunction with the documentation for the permissions import, the metadata import or the user-drive mapping feature.
Example 1: Creating a job using the wizard
In this example, the command run will launch a job creation wizard that will walk you through creating a job. The authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
The wizard will prompt for a job name, desire to customize the schedule, source platform, source connection, source path, destination platform, destination connection, and destination path.
Example wizard
Example 2: Creating a job providing the options from the stdin
This feature is available only with scripting such as within a PowerShell or Node script. In this example, the the job will be created by providing the JSON contents as a parameter and the schedule will be set to manual. The authentication parameters are provided within the configuration file. See the authentication section for more information.
Command with variables (PowerShell)
The expected output is the same as the requesting the details of the job.
Sample expected results
Example 3: Creating a job providing the options from a file
In this example, the the job will be created by providing the location of the JSON options file and the schedule will be set to manual. The authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
Contents of job1Options.json with variables
Contents of job1Options.json with sample values
The expected output is the same as the requesting the details of the job.
Sample expected results
Clone a Job
This command will clone a job and optionally change the cloned job's configuration.
parameter | description | required | default |
---|---|---|---|
name | The job name | optional | The name of the job being cloned |
job-input, in | Read JSON job from stdin | optional |
|
job-file, file | The job JSON file | optional |
|
Example 1: Clone a job with a new name
In this example, the command will clone an existing job with the given ID and assign the cloned job a new name. The authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
Example 2: Clone a job providing the option changes from the stdin
This feature is available only with scripting such as within a PowerShell or Node script. In this example, the the job will be created by providing the JSON contents as a parameter and the delete_propagation
policy is set to ignore_source
. The authentication parameters are provided within the configuration file. See the authentication section for more information.
Command with variables (PowerShell)
The expected output is the same as the requesting the details of the job.
Sample expected results
Example 3: Clone a job providing the option changes from a file
In this example, the the job will be created by providing the location of the JSON options file with the same outcome as Example 2 above. The authentication parameters are provided within the configuration file. See the authentication section for more information.
Command
Contents of jobOptions.json with variables
The expected output is the same as the requesting the details of the job.
Sample expected results
Start Job(s)
This command will start the specified job(s). At least one job specification must be provided in order to start jobs. If the ID is provided, that job will be started. If any of the other parameters are provided, then those will be used to filter the entire job list and start the jobs based on the provided filtering parameters. For more information on this feature, reference: Start/Pause multiple jobs.
parameter | description | required | default |
---|---|---|---|
id | The ID of the job to start | optional |
|
all | Starts all the jobs | optional |
|
kind | Job Kind | optional |
|
search, q | Search text | optional |
|
active | Only retrieve active jobs | optional |
|
offset | Search offset | optional | 0 |
limit | Search page size | optional | 20 |
Example 1: Start a specific job by job ID
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
Command with example values
Expected results
Expected results (JSON)
If the ID entered does not correspond to an existing job, for example, if the job was already deleted, the expected output is the following.
Expected results
Expected results (JSON)
Example 2: Starting all jobs
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
Expected results
Expected results (JSON)
Example 3: Starting a filtered list of jobs
In the following example, we'll filter the jobs list by parent job, search text, kind of job, and active state. We'll then further filter the list by using an offset and limiting the number of jobs to start. The authentication parameters are provided within the configuration file. See the authentication section for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
Here, only jobs with the parent specified will start, and then only those with text "testjob" in their names, and are of type "transfer", and those that are active. Finally, the first two jobs will be skipped, and only the next five jobs will be started.
Command with sample values
Expected results
Expected results (JSON)
Pause Job(s)
This command will pause the specified job
parameter | description | required | default |
---|---|---|---|
id | The ID of the job to start | optional |
|
all | Pause all the jobs | optional |
|
kind | Job Kind | optional |
|
search, q | Search text | optional |
|
status | Search by the current job status (idle, start, running, paused) | optional |
|
parent | Search by the parent job ID | optional |
|
node | Search by the currently executing node address | optional |
|
active | Only retrieve active jobs | optional |
|
offset | Search offset | optional | 0 |
limit | Search page size | optional | 20 |
Example 1: Pause a specific job by job ID
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
Command with example values
Expected results
Expected results (JSON)
If the ID entered does not correspond to an existing job, for example, if the job was already deleted, the expected output is the following.
Expected results
Expected results (JSON)
Example 2: Pausing all jobs
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
Expected results
Expected results (JSON)
Example 3: Pausing a filtered list of jobs
In the following example, we'll filter the jobs list by parent job, search text, kind of job, and active state. We'll then further filter the list by using an offset and limiting the number of jobs to pause. The authentication parameters are provided within the configuration file. See the authentication section for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
Here, only jobs with the parent specified will pause, and then only those with text "testjob" in their names, and are of type "transfer", and those that are active. Finally, the first two jobs will be skipped, and only the next five jobs will be paused.
Command with sample values
Expected results
Expected results (JSON)
Delete a Job
This command will delete the specified job
parameter | description | required | default |
---|---|---|---|
id | The ID of the job to be deleted | required |
|
In the following example, the authentication parameters are provided within the configuration file. See the authentication section for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
Command with example values
Expected results
If the ID entered does not correspond to an existing job, for example, if the job was already deleted, the expected output is the following.
Expected results
Job Items
This command will produce a list of items that have been identified in relation to a job. A parameter is required when generating a job items list. If you do not use a parameter, you will receive an error: "Not enough non-option arguments: got 0, need at least 1"
parameter | description | required | default |
---|---|---|---|
id | The ID of the job for which to list items | optional | none |
search, q | Search text | optional |
|
offset | Search offset | optional | 0 |
limit | Search page size | optional | 20 |
--csv | output format of the report | optional | JSON |
In the following examples, authentication parameters are provided within the configuration file. See the authentication section for more information.
Example 1: List job items for a specific job
The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with no parameters
Expected results
Expected results (JSON)
Job Folders
This command will produce a list of folders that have been identified in relation to a job.
parameter | description | required | default |
---|---|---|---|
id | The ID of the job for which to list items | optional | none |
search, q | Search text | optional |
|
offset | Search offset | optional | 0 |
limit | Search page size | optional | 20 |
In the following examples, authentication parameters are provided within the configuration file. See the authentication section for more information.
Example 1: List all job folders
List all the job items. This command only returns the first page of 20 records and not all the folders. You can add--limit
and --offset
to handle pagination if needed.
Command with no parameters
Expected results
Expected results (JSON)
Example 2: List folders for a specific job
List folders for a specific job
Command with no parameters
Expected results similar to the previous example.
Job Security Mappings
This command will produce a list of folders that have been identified in relation to a job.
parameter | description | required | default |
---|---|---|---|
id | The ID of the job for which to list security mappings | optional | none |
search, q | Search text | optional |
|
offset | Search offset | optional | 0 |
limit | Search page size | optional | 20 |
In the following examples, authentication parameters are provided within the configuration file. See the authentication section for more information.
Example 1: List all job security mappings
List all the job security mappings
Command with no parameters
Expected results
Expected results (JSON)
Example 2: List security mappings for a specific job
List security mappings for a specific job
Command with no parameters
Expected results similar to the previous example.
Audit Job(s)
This command will produce an audit report of job executions.
parameter | description | required | default |
---|---|---|---|
id | The ID of the job to audit | optional | none |
--execution <execution-id> | the execution instance id of a job | optional | none |
--csv | output format of the report | optional | JSON |
In the following examples, authentication parameters are provided within the configuration file. See the authentication section for more information.
Example 1: Produce an audit report for all jobs
Without parameters, the following will output an audit for all jobs. Note, that if a job did not transfer items and the resulting items block is empty, the audit
command will return an empty brackets [].
Command with no parameters
Example 2: Produce an audit report for a specific job
By specifying an id parameter, the following will output an audit for a specific job.
Command with example values
For both commands above, you can expect output like the following:
Expected results
Example 3: Produce an audit report for a specific job in CSV format
Adding the --csv
option produces an audit report in comma-delimited value (CSV) format. Without it, output is formatted as JSON.
Command with example values
For the above command, you can expect output like the following:
Expected results
Example 4: Produce an audit report for a specific execution of a specific job
Adding a --execution
option produces an audit report for a specific execution of the specified job. Note, execution_id
may not be sequential for a specific job and can be found within the response from the command: skysync-cli jobs audit
Execution option
Report Job History
This command will produce a report of job execution history
parameter | description | required | default |
---|---|---|---|
id | The ID of the job to report on | optional | none |
--execution <execution-id> | the execution instance id of a job | optional | none |
--execution last | specifies the last job execution | optional |
|
--execution current | specifies the current job execution | optional |
|
--csv | output format of the report | optional | JSON |
In the following examples, authentication parameters are provided within the configuration file. See the authentication section for more information.
Example 1: Produce a history report for all jobs
Without parameters, the following will output a history report for all jobs.
Command with no parameters
Example 2: Produce a history report for a specific job
By specifying an id parameter, the following will output a history report for a specific job.
Command with example values
Example 3: Produce a history report for a specific job in CSV format
Adding the --csv
option produces a history report in comma-delimited value (CSV) format. Without it, output is formatted as JSON.
Command with example values
Example 4: Produce a history report for a specific execution of a specific job
Adding a --execution
option produces a history report for a specific execution of the specified job. Note, execution_id
may not be sequential for a specific job and can be found within the reponse from the command: skysync-cli jobs audit
Execution option
Example 5: Produce a history report for the last execution of a specific job
Adding a --execution
option with a last
parameter produces a history report for the last execution of the specified job.
Execution option
Example 6: Produce a history report for the current execution of a specific job
Adding a --execution
option with a current
parameter produces a history report for the current execution of the specified job. If the specified job is between executions, this will return null.
Execution option