• 製品
  • 使用を開始する
  • 関連ドキュメント
  • リソース

Windows を使用してジョブをスケジューリングする

Assets Data Manager for Jira Service Management Cloud is currently rolling out in Open Beta and will be available to all Premium + Enterprise sites by end of October 2024.

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:

前提条件

  1. Mac の Finder アプリ ([アプリケーション] > [ユーティリティ] > [ターミナル]) に移動して、コマンド ライン インターフェイスを開きます

  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

前提条件

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

  1. Windows タスク スケジューラを開く

  2. データ マネージャー」というサブフォルダーを作成します。

  3. 右側のペインから [タスクの作成] を選択すると、[タスクの作成] ボックスが表示されます。 

  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. ラジオ ボタン [ユーザーがログオンしているかどうかにかかわらず実行する] を選択します。

  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. [トリガー] タブをクリックし、[新規…] をクリックします。

  2. ジョブを実行するタイミングの詳細 (毎日、毎週、毎月、開始時間など) を入力します。

  3. OK をクリックします。

  4. [アクション] タブをクリックし、[新規…] をクリックします。 

  5. [操作:] が [プログラムの開始] に設定されていることをご確認ください。

  6. Enter the Program/script as assets.adapters.client.app.exe.

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

    1. [トリガー] タブをクリックし、[新規…] をクリックします。

    2. ジョブを実行するタイミングの詳細 (毎日、毎週、毎月、開始時間など) を入力します。

    3. OK をクリックします。

    4. [アクション] タブをクリックし、[新規…] をクリックします。 

    5. [操作:] が [プログラムの開始] に設定されていることをご確認ください。

    6. Enter the Program/script as assets.adapters.client.app.exe.

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

      1. [トリガー] タブをクリックし、[新規…] をクリックします。

      2. ジョブを実行するタイミングの詳細 (毎日、毎週、毎月、開始時間など) を入力します。

      3. OK をクリックします。

      4. [アクション] タブをクリックし、[新規…] をクリックします。 

      5. [操作:] が [プログラムの開始] に設定されていることをご確認ください。

      6. Enter the Program/script as assets.adapters.client.app.exe.

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

        1. [トリガー] タブをクリックし、[新規…] をクリックします。

        2. ジョブを実行するタイミングの詳細 (毎日、毎週、毎月、開始時間など) を入力します。

        3. OK をクリックします。

        4. [アクション] タブをクリックし、[新規…] をクリックします。 

        5. [操作:] が [プログラムの開始] に設定されていることをご確認ください。

        6. Enter the Program/script as assets.adapters.client.app.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:/jsm-data-manager-clients/node-modules/@data-manager-packages/production-win-x64/Assets.Adapters.Client.win-x64/Assets.Adapters.Client.App.exe
  2. [設定] タブ内をクリックします。

  3. [タスクを停止するまでの時間] を [3 日間] から [1 時間] に変更します。

  4. OK をクリックします。

  5. サービス アカウントを使用してタスクを開始すると、サービス アカウントのパスワードを入力するよう求められます。対応するパスワードを入力して、[保存] ボタンをクリックします。

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.

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。