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 CLI: Authentication page for more information.
Command
skysync-cli jobs listExpected 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 idleExample 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 CLI: Authentication page for more information.
Command
skysync-cli jobs list --kind transfer
Example 3: List active jobs
In the following example, the authentication parameters are provided within the configuration file. See the CLI: Authentication page for more information.
Command
skysync-cli jobs list --active
Example 4: List jobs with "test" in their name
In the following example, the authentication parameters are provided within the configuration file. See the CLI: Authentication page for more information.
Command
skysync-cli jobs list --search testCommand
skysync-cli jobs list -q "test"
Example 5: List the jobs skipping the first 5
In the following example, the authentication parameters are provided within the configuration file. See the CLI: Authentication page for more information.
Command
skysync-cli jobs list --offset=5
Example 6: List running jobs
In the following example, the authentication parameters are provided within the configuration file. See the CLI: Authentication page for more information.
Command
skysync-cli jobs list "--status=start,running"
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 CLI: Authentication page for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
skysync-cli jobs show {{id}}Command with example values
skysync-cli jobs show bb7d0ba7015d4c9eab58a28ef46109f5Example results
ID bb7d0ba7015d4c9eab58a28ef46109f5
Name Transfer Job 1
Kind transfer
Enabled true
Status idleExample results (JSON)
[
{
"id": "bb7d0ba7015d4c9eab58a28ef46109f5",
"name": "Transfer Job 1",
"kind": "transfer",
"disabled": false,
"status": "idle"
}
]
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
ID
Name
Kind
Enabled true
StatusExpected results (JSON)
null
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 job 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 CLI: Authentication page for more information.
Command
skysync-cli jobs add
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
This wizard will walk you through creating a new job
Do you want to continue? (Y) y
Enter the job name: [default] Wizard Created Job 1
Do you want to customize the schedule? (N)
What platform do you want for the source of the job?
(1) Box
(2) My Computer
(3) Network File System
(4) Microsoft OneDrive for Business
: 3
What connection do you want for the source of the job?
(1) Network File System (\\server1\folder1)
(2) Network File System (\\server2\folder2)
(3) Add a new Network File System connection
: 1
What is the source path? /source
What platform do you want for the destination of the job?
(1) Box
(2) My Computer
(3) Network File System
(4) Microsoft OneDrive for Business
: 3
What connection do you want for the destination of the job?
(1) Network File System (\\server1\folder1)
(2) Network File System (\\server2\folder2)
(3) Add a new Network File System connection
: 2
What is the destination path? /wizardjob1
ID 16e5f218ab4142c8b0c05158aa573d85
Name Wizard Created Job 1
Kind transfer
Enabled true
Status
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 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 CLI: Authentication page for more information.
This feature is not supported from a standard terminal such as a command line; however, piping may be utilized to pass in the json option block via Node or PowerShell. See example below.
Command with variables (PowerShell)
'{"transfer": {"source": {"connection": {"id": "{{sourceConnectionId"}, "target": {"path": "{{sourcePath}}"}}, "destination": {"connection": {"id": "{{destinationConnectionId"}, "target": {"path": "{{destinationPath}}"}}}}' | skysync-cli jobs add --manual --in
The expected output is the same as the requesting the details of the job.
Sample expected results
ID 8b9ea3d812e24d7892d88d63acb40402
Name : to
Kind transfer
Enabled true
Status
Example 3: Creating a job providing the options from a file
In this example, 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 CLI: Authentication page for more information.
Command
skysync-cli jobs add --manual --job-file=job1Options.JSONContents of jobOptions.json with variables
{
"transfer":
{
"source":
{
"connection":
{
"id": "{{sourceConnectionId}}"
},
"target":
{
"path": "{{sourcePath}}"
}
},
"destination":
{
"connection":
{
"id": "{{destinationConnectionId}}"
},
"target":
{
"path": "{{destinationPath}}"
}
}
}
}Contents of jobOptions.json with sample values
{
"transfer":
{
"source":
{
"connection":
{
"id": "490d8c2eba054392bde988a548d88354"
},
"target":
{
"path": "/source"
}
},
"destination":
{
"connection":
{
"id": "fbc78a0fa9074d20b778e6e6fc1bd898"
},
"target":
{
"path": "/destination"
}
}
}
}
The expected output is the same as the requesting the details of the job.
Sample expected results
ID 8b9ea3d812e24d7892d88d63acb40402
Name : to
Kind transfer
Enabled true
Status
PowerShell Example script can be found within the skysync-cli project at ~skysync-cli/examples/skysync-cli-example-create-job-01.ps1
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 CLI: Authentication page for more information.
Command
skysync-cli jobs clone 713291003ecf44749166db782df4c4e5 --name "Cloned Job"
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 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 CLI: Authentication page for more information.
This feature is not supported from a standard terminal such as a command line; however, piping may be utilized to pass in the json option block via Node or PowerShell. See example below.
Command with variables (PowerShell)
'{"transfer": {"delete_propagation": "ignore_source"},"name": "Cloned Job"}' | skysync-cli jobs clone 713291003ecf44749166db782df4c4e5 --in
The expected output is the same as the requesting the details of the job.
Sample expected results
ID 8b9ea3d812e24d7892d88d63acb40402
Name Cloned Job
Kind transfer
Enabled true
Status
Example 3: Clone a job providing the option changes from a file
In this example, 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 CLI: Authentication page for more information.
Command
skysync-cli jobs clone 713291003ecf44749166db782df4c4e5 --job-file=jobOptions.jsonContents of jobOptions.json with variables
{
"name": "Cloned Job",
"transfer": {
"delete_propagation": "ignore_source"
}
}
The expected output is the same as the requesting the details of the job.
Sample expected results
ID 3b238054a02144c2bbd32b5c650ee7ae
Name Cloned Job
Kind transfer
Enabled true
Status
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 CLI: Authentication page for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
skysync-cli jobs start {{id}}Command with example values
skysync-cli jobs start 5dc531df34554edd96c31272262ad950Expected results
ID 5dc531df34554edd96c31272262ad950
Name Test Transfer Job 1
Kind transfer
Enabled true
Status startExpected results (JSON)
[
{
"id": "5dc531df34554edd96c31272262ad950",
"name": "Test Transfer Job 1",
"kind": "transfer",
"disabled": false,
"status": "start"
}
]
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
ID
Name
Kind
Enabled true
StatusExpected results (JSON)
null
Example 2: Starting all jobs
In the following example, the authentication parameters are provided within the configuration file. See the CLI: Authentication page for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
skysync-cli jobs start --allExpected results
8 jobs startedExpected results (JSON)
[
{
"total_count": "8"
}
]
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 CLI: Authentication page for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
skysync-cli jobs start --parent={{parentJobID}} --offset={{offset}} --limit={{limit}} --search={{searchText}} --kind={{jobKind}} --active
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
skysync-cli jobs start --parent=5dc531df34554edd96c31272262ad950 --offset=2 --limit=5 --search=testjob --kind=transfer --activeExpected results
5 jobs startedExpected results (JSON)
[
{
"total_count": "5"
}
]
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 CLI: Authentication page for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
skysync-cli jobs pause {{id}}Command with example values
skysync-cli jobs pause 5dc531df34554edd96c31272262ad950Expected results
ID 5dc531df34554edd96c31272262ad950
Name Test Transfer Job 1
Kind transfer
Enabled true
Status pausedExpected results (JSON)
[
{
"id": "5dc531df34554edd96c31272262ad950",
"name": "Test Transfer Job 1",
"kind": "transfer",
"disabled": false,
"status": "paused"
}
]
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
ID
Name
Kind
Enabled true
StatusExpected results (JSON)
null
Example 2: Pausing all jobs
In the following example, the authentication parameters are provided within the configuration file. See the CLI: Authentication page for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
skysync-cli jobs pause --allExpected results
8 jobs pausedExpected results (JSON)
[
{
"total_count": "8"
}
]
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 CLI: Authentication page for more information. The parameters within the two curly braces (including the braces) will need to be replaced with valid values.
Command with variables
skysync-cli jobs pause --parent={{parentJobID}} --offset={{offset}} --limit={{limit}} --search={{searchText}} --kind={{jobKind}} --active
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
skysync-cli jobs pause --parent=5dc531df34554edd96c31272262ad950 --offset=2 --limit=5 --search=testjob --kind=transfer --activeExpected results
5 jobs pausedExpected results (JSON)
[
{
"total_count": "5"
}
]
Delete a Job
This command will delete the specified job
parameter | description | required | default |
|---|---|---|---|
id |
