> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/keeperpam/jp/endpoint-privilege-manager/policies/policy-types/advanced-policy-types/update-jobs-policy-type.md).

# ジョブ更新

<figure><img src="/files/P3N87CcUNSoxGaOiPvjg" alt=""><figcaption></figcaption></figure>

**ジョブ更新**ポリシーを使うと、エンドポイント上の**ジョブ定義**を一元的に配布・更新・削除できます。

## 仕組み <a href="#how-it-works" id="how-it-works"></a>

エージェントは、`PolicyType` が **`"JobUpdate"`** のポリシーを処理します。`Extension` の内容に応じて、エンドポイント上の `Jobs/{JobId}.json` のジョブ定義を追加・更新・削除します。

### 手順: ジョブ更新ポリシーの作成 (高度なJSONから)

{% stepper %}
{% step %}
**\[エンドポイント特権マネージャー]** → **\[ポリシー]** に移動

<figure><img src="/files/xOBTy3Jgtedu9vzBQ5wl" alt="Policies" width="563"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**\[ポリシーの作成]** ボタンをクリック

ポリシー作成用のモーダルが開きます。

<figure><img src="/files/XHKd2FVOUoUHS2vWc32s" alt="Create Policy Form" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**ポリシー属性の定義**

ポリシーには分かりやすい名前を付けます。

UIに表示されている**既存のポリシータイプのいずれか**をテンプレートとして選びます (タイプは後のJSON手順で `JobUpdate` に上書きします)。

ステータスを選びます。初めて用意するときは**監視**を推奨します。

**\[コントロールを追加]** をクリックし、ポリシーに適用するコントロールを1つ以上選びます。

ユーザーグループ、マシンコレクション、アプリケーションコレクションを指定します。
{% endstep %}

{% step %}
**ポリシーターゲットの構成**

UIで、コレクション/ユーザー/マシン/アプリ/プラットフォームなど、ポリシーの適用対象を設定します。
{% endstep %}

{% step %}
**\[Advanced Mode]** (JSONビュー) を開く

ポリシーフォーム左下の **\[Advanced Mode]** リンクをクリックします。

<figure><img src="/files/H11sOzv6HEnMtuqDqyHn" alt="Policy Form Advanced Mode"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**JSONでポリシータイプを再定義**
{% endstep %}

{% step %}
**Extensionフィールドの定義**

[必須の拡張フィールド](#required-extension-fields)の説明に従い、`Extension` の各フィールドを設定します。
{% endstep %}

{% step %}
**ポリシーを保存**
{% endstep %}
{% endstepper %}

### 必須の拡張フィールド <a href="#required-extension-fields" id="required-extension-fields"></a>

* `Extension.JobId`: ジョブ識別子。エージェントが `Jobs/{JobId}.json` を書き込み/削除するときのキー
* `Extension.Action`: `"Add"`、`"Update"`、または `"Delete"`
* `Extension.JobJson`: 追加・更新の際に必須。削除の際は省略

**IDの要件:** `JobJson` 内の `id` は、必ず `JobId` と同じ値にします。

## JSONの例 <a href="#example-json-snippets" id="example-json-snippets"></a>

### 例1: ジョブの追加 (JobUpdate / Action=Add) <a href="#example-1-add-a-job-jobupdate-action-add" id="example-1-add-a-job-jobupdate-action-add"></a>

```
{
  "PolicyName": "Update Jobs - Add Maintenance Job",
  "PolicyType": "JobUpdate",
  "PolicyId": "REPLACE_WITH_ID",
  "Status": "on",
  "Actions": {
    "OnSuccess": {
      "Controls": [
        "NOTIFY"
      ]
    },
    "OnFailure": {
      "Command": ""
    }
  },
  "NotificationMessage": "A job was added to this endpoint via policy.",
  "NotificationRequiresAcknowledge": false,
  "RiskLevel": 20,
  "Operator": "And",
  "Rules": [
    {
      "RuleName": "UserCheck",
      "ErrorMessage": "This user is not included in this policy",
      "RuleExpressionType": "BuiltInAction",
      "Expression": "CheckUser()"
    },
    {
      "RuleName": "MachineCheck",
      "ErrorMessage": "This Machine is not included in this policy",
      "RuleExpressionType": "BuiltInAction",
      "Expression": "CheckMachine()"
    }
  ],
  "UserCheck": [],
  "MachineCheck": [],
  "ApplicationCheck": [],
  "DayCheck": [],
  "DateCheck": [],
  "TimeCheck": [],
  "CertificationCheck": [],
  "Extension": {
    "JobId": "my-maintenance-job",
    "Action": "Add",
    "JobJson": "{\n  \"id\": \"my-maintenance-job\",\n  \"name\": \"My Maintenance Job\",\n  \"description\": \"Runs periodic maintenance actions.\",\n  \"enabled\": true,\n  \"schedule\": {\n    \"type\": \"interval\",\n    \"minutes\": 60\n  },\n  \"tasks\": [\n    {\n      \"type\": \"command\",\n      \"name\": \"Example Task\",\n      \"command\": \"echo Maintenance job ran\"\n    }\n  ]\n}"
  }
}
```

**注**

* `Extension.JobJson` は、ジョブ定義のJSONを1本の**文字列**として渡すフィールドです (中身はジョブJSONの全体)。
* 内側のジョブJSONに `"id": "my-maintenance-job"` を含め、`JobId` と一致させてください。

### 例2: 既存ジョブの更新 (JobUpdate / Action=Update) <a href="#example-2-update-an-existing-job-jobupdate-action-update" id="example-2-update-an-existing-job-jobupdate-action-update"></a>

```
{
  "PolicyName": "Update Jobs - Update Maintenance Job",
  "PolicyType": "JobUpdate",
  "PolicyId": "REPLACE_WITH_ID",
  "Status": "on",
  "Actions": {
    "OnSuccess": {
      "Controls": [
        "NOTIFY"
      ]
    },
    "OnFailure": {
      "Command": ""
    }
  },
  "NotificationMessage": "A job was updated on this endpoint via policy.",
  "NotificationRequiresAcknowledge": false,
  "RiskLevel": 20,
  "Operator": "And",
  "Rules": [
    {
      "RuleName": "UserCheck",
      "ErrorMessage": "This user is not included in this policy",
      "RuleExpressionType": "BuiltInAction",
      "Expression": "CheckUser()"
    },
    {
      "RuleName": "MachineCheck",
      "ErrorMessage": "This Machine is not included in this policy",
      "RuleExpressionType": "BuiltInAction",
      "Expression": "CheckMachine()"
    }
  ],
  "UserCheck": [],
  "MachineCheck": [],
  "ApplicationCheck": [],
  "DayCheck": [],
  "DateCheck": [],
  "TimeCheck": [],
  "CertificationCheck": [],
  "Extension": {
    "JobId": "my-maintenance-job",
    "Action": "Update",
    "JobJson": "{\n  \"id\": \"my-maintenance-job\",\n  \"name\": \"My Maintenance Job\",\n  \"description\": \"Runs periodic maintenance actions (updated schedule).\",\n  \"enabled\": true,\n  \"schedule\": {\n    \"type\": \"interval\",\n    \"minutes\": 30\n  },\n  \"tasks\": [\n    {\n      \"type\": \"command\",\n      \"name\": \"Example Task\",\n      \"command\": \"echo Maintenance job ran (updated)\"\n    }\n  ]\n}"
  }
}
```

**注**

* 更新では通常、`JobJson` で渡した内容によりジョブファイル全体が置き換わるため、ジョブスキーマで必要なフィールドはすべて含めます。

### 例3: ジョブの削除 (JobUpdate / Action=Delete) <a href="#example-3-delete-a-job-jobupdate-action-delete" id="example-3-delete-a-job-jobupdate-action-delete"></a>

```
{
  "PolicyName": "Update Jobs - Delete Maintenance Job",
  "PolicyType": "JobUpdate",
  "PolicyId": "REPLACE_WITH_ID",
  "Status": "on",
  "Actions": {
    "OnSuccess": {
      "Controls": [
        "NOTIFY"
      ]
    },
    "OnFailure": {
      "Command": ""
    }
  },
  "NotificationMessage": "A job was deleted from this endpoint via policy.",
  "NotificationRequiresAcknowledge": false,
  "RiskLevel": 20,
  "Operator": "And",
  "Rules": [
    {
      "RuleName": "UserCheck",
      "ErrorMessage": "This user is not included in this policy",
      "RuleExpressionType": "BuiltInAction",
      "Expression": "CheckUser()"
    },
    {
      "RuleName": "MachineCheck",
      "ErrorMessage": "This Machine is not included in this policy",
      "RuleExpressionType": "BuiltInAction",
      "Expression": "CheckMachine()"
    }
  ],
  "UserCheck": [],
  "MachineCheck": [],
  "ApplicationCheck": [],
  "DayCheck": [],
  "DateCheck": [],
  "TimeCheck": [],
  "CertificationCheck": [],
  "Extension": {
    "JobId": "my-maintenance-job",
    "Action": "Delete"
  }
}
```

**注**

* `Delete` のときは `JobJson` を書かないでください。

## 運用でよく変える項目 <a href="#what-will-typically-be-edited-in-real-use" id="what-will-typically-be-edited-in-real-use"></a>

* `PolicyId`: UIで採番された値のままにします。
* `Status`: 展開状況に応じて `"on"` / `"off"` を切り替えます。
* `UserCheck` / `MachineCheck`: コンソールの通常の適用対象と同じ要領で配列を埋めます。
* `Extension.JobId`: ファイル名のキー (エンドポイント上では `Jobs/{JobId}.json` になります)。
* `Extension.JobJson`: 追加・更新用にジョブ定義全体を文字列化したもの。

## エンドポイントでの検証 <a href="#validate-on-an-endpoint" id="validate-on-an-endpoint"></a>

* **追加・更新**の際は、`Jobs/{JobId}.json` が存在し、渡したジョブJSONの内容と一致していることを確認します。
* **削除**の際は、`Jobs/{JobId}.json` がなくなっていることを確認します。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/endpoint-privilege-manager/policies/policy-types/advanced-policy-types/update-jobs-policy-type.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
