• Get started
  • Documentation

Schedule a job

Assets Data Manager for Jira Service Management Cloud is a Premium and Enterprise only feature that is currently in Open Beta development. View and vote on our list of upcoming features.

If you find a bug or have questions, please reach out to Atlassian Support or the Atlassian Community.

The instructions below are for setting up a scheduled task to bring data into Data Manager using third-party scheduling apps and the Adapters client.

The two apps used for demonstration are Cron (for MacOS/Linux) and Windows Scheduler (for Windows/DOS) but any scheduling app may be used as long as the command running the Adapters client is correctly configured.

One scheduled task should exist for each Data Source that you want to import.

If you have a process of placing the files on a server for consumption, additional scheduled tasks may be required to copy the files to the appropriate location for the Adapters client to consume.

You should leave an appropriate amount of time (for example, 1 hour) between scheduled tasks to allow them to complete.

Schedule a job using the Adapters client with a Cron job in MacOS and Linux

To create a Cron job to run the Adapters client:

Prerequisites

  1. Open a command line interface by navigating to the Finder App in Mac (Applications > Utilities > Terminal).

  2. Navigate to the location of the Adapters client.

    1 cd ~/jsm-data-manager-clients/Assets.Adapters.Client.app
  3. Create a new script to run the Adapters client. Make a new .sh file using a text editor like Nano. The example below creates a file named test-script.sh:

    1 nano test-script.sh
  4. Now enter the command that runs the Adapters client. You will need both your WorkspaceID and an Adapters token. Here’s a sample script:

    1 2 3 #!/bin/bash echo "This is an sample Bash script that runs the Adapters client." ./Assets.Adapters.Client.app --workspace-id <workspaceId> --token <your-token> –-run <full>

Use double quotes (“) to wrap the name of the job, particularly when there are spaces in the task name. 

  1. Save the script.

  2. Make the script executable using the chmod command.

    1 chmod +x test-script.sh
  3. Next, open the Crontab file by typing the following: The file opens in the vi editor. If the crontab had not previously existed, a new file is created.

    1 crontab -e

To schedule a job for a different user, add the -u option: crontab -u [username] -e

  1. Add a line containing a Cron expression and the path to the script:

    1 [cron-expression] [path-to-script]

    A Cron expression consists of five fields that accept the respective number values:

    1 [minute: 0-59] [hour: 0-23] [day: 1-31] [months: 1-12] [weekday: 0-6]

The zero in the weekday field stands for Sunday, one for Monday, two for Tuesday, etc.

The syntax also allows the following special characters:

  • (*) includes all values.

  • (/) divides the value into steps, e.g., */2 in the day field means "every second day."

  • (-) allows creating a range of values, e.g., 1-3 in the month field means "from January to March."

  • (,) specifies individual values, e.g., 1,3 in the weekday field means "on Monday and Wednesday."

  1. Press i to turn on the Insert Mode.

  2. Add the following line to the crontab file to run our test script every Tuesday and Thursday at 6 p.m.:

    1 0 18 * * 2,4 /Users/[username]/test-script.sh
  3. Press ESC to leave insert mode.

  4. Save the file and exit by pressing the colon : and then x to save the edits to your crontab.

  5. You can view your list of existing cron jobs using the crontab command. The output displays all the previously added Cron expressions.

    1 crontab -l

Schedule a job using the Adapters client with Windows Scheduler in Windows/DOS

Prerequisites

To create a task in Windows Task Scheduler to run the Adapters Client:

  1. Open Windows Task Scheduler

  2. Create a subfolder called Data Manager.

  3. Select Create Task from the right hand pane and you are presented with the Create Task box

  4. Enter the name of the task; which is something meaningful for the job to be done. In this example we’ll use Test, but a more suitable name could be “Run a job for JSM Assets”.

  5. Select the radio button "Run whether user is logged on or not".

  6. Click on Change User or Group and enter select the service account details. 

Typically, a Service account is used to execute the job. A service account has the advantage of not being tied to an individual, so the account’s password remains static and it can run as batch.

  1. Click on the Trigger tab and click on New….

  2. Enter the details of when the job will be executed (daily, weekly, monthly, the time of dat to start etc).

  3. Click OK.

  4. Click in the Action tab and click on New…

  5. Ensure Actions: is set to Start a program.

  6. Enter the Program/script as dm-adapters.exe.

  7. You must enter the following in the Add arguments (optional) field:

    1. Click on the Trigger tab and click on New….

    2. Enter the details of when the job will be executed (daily, weekly, monthly, the time of dat to start etc).

    3. Click OK.

    4. Click in the Action tab and click on New…

    5. Ensure Actions: is set to Start a program.

    6. Enter the Program/script as dm-adapters.exe.

    7. You must enter the following in the Add arguments (optional) field:

      1. Click on the Trigger tab and click on New….

      2. Enter the details of when the job will be executed (daily, weekly, monthly, the time of dat to start etc).

      3. Click OK.

      4. Click in the Action tab and click on New…

      5. Ensure Actions: is set to Start a program.

      6. Enter the Program/script as dm-adapters.exe.

      7. You must enter the following in the Add arguments (optional) field:

        1. Click on the Trigger tab and click on New….

        2. Enter the details of when the job will be executed (daily, weekly, monthly, the time of dat to start etc).

        3. Click OK.

        4. Click in the Action tab and click on New…

        5. Ensure Actions: is set to Start a program.

        6. Enter the Program/script as dm-adapters.exe.

        7. You must enter the following in the Add arguments (optional) field:

          1. You must specify the WorkspaceID, for example:

            1 --workspaceid e44regc98-8d2r-3af7-011t-209p44716366
          2. You must specify the Adapters Client token, for example:

            1 --token ATCTT3xFrTN0U64VR99p1VfpQtLlpar7R4hq6PSkiNNaNOyk37P_7URVmROOp1Orez-ijlluMRwJA7Cw1LsgMFqFnvhJapdniv4ewDc0twt7vPBhrbDts1fyPOW6Tw3S-Gzg6rRaEULWl2_JqQNvictFu_hK6wGxpGRvPTpyaQXzr9MtQ_8yKDms=0433HC52
          3. You must specify the name of the job:

            1 --run myJobName

Use double quotes (“) to wrap the name of the job, particularly when there are spaces in the task name. 

  1. The Start in (optional): field is where the Data Manager client executable resides in the server (refer to the prerequisites). Specify the destination folder where the Data Manager client resides:

    1 c:\users\public\assets_data_manager\data_manager_clients\win-x64\assets-adapters-client\
  2. Click in the Settings tab.

  3. Change the Stop the task if it runs longer than: from 3 days to 1 hour.

  4. Click OK.

  5. If the service account is used to initiate the task, you will be asked to enter the password for the service account. Enter the corresponding password and click on the SAVE button.

The task is now saved and can be executed from the task scheduler, it will be ran at the time defined in the above steps. The scheduled tasks can be tested by selecting the Task Name and selecting Run.

Still need help?

The Atlassian Community is here for you.