# Change cronjob of a web hosting package

> Change what a cronjob runs, when, how it reports, its status or description.

- Effect: Write - Changes the account. Agents ask first.
- Idempotent: yes
- Stability: beta
- MCP tool: `manitu_webhosting_web_cronjob_set` on https://mcp.manitu.de/mcp
- REST: `POST https://api.manitu.de/v1/webhosting/web/cronjob/set`
- Needs: `service_webhosting`
- Page: /reference/webhosting/web/cronjob/set/

**Changes the account. Agents say what will happen and wait for an explicit yes before calling it.**

## MCP tool

`manitu_webhosting_web_cronjob_set`

### Description for the model

Changes a cronjob of a web hosting package of the manitu customer account this connection works in, by site_id and cronjob_id from manitu_webhosting_web_cronjob_list. Only the fields given change, also inside task and report ({"report": {"mail": {"recipient": "..."}}} changes only that); task.command, url, script_path only for the task type it has (or is given). status inactive switches it off without deleting it. schedule is a cron expression in Europe/Berlin. Refused with a conflict when the package cannot be changed now (not_configurable). Changes are active a few minutes later. Tell the customer what will change and ask for an explicit yes first.

### Arguments

- `site_id` (integer | string, required) - The site_id from manitu_webhosting_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `cronjob_id` (integer | string, required) - The cronjob_id from manitu_webhosting_web_cronjob_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `task` (object) - What it runs: type, and the one field that type uses. When the type changes, that field has to come along. In set, only the fields given change.
  - `task.type` (string) - What it runs: command (a shell command, with command), url (calls a URL, with url), php_script (a PHP file of the package, with script_path). (one of `"command"`, `"url"`, `"php_script"`)
  - `task.command` (string) - For type command: the command, run with bash as the package's user in its root directory. Only letters, digits, space and _ - " ' . / : = + - no redirection (> >> 2>), no pipe, nothing sent to the background, no ; or &&. For output use the report instead. (minLength `1`; maxLength `1024`)
  - `task.url` (string) - For type url: the URL called (http or https) - reachable without login or IP restriction, answering with status 200. (minLength `1`; maxLength `2048`)
  - `task.script_path` (string) - For type php_script: the PHP file, relative to the package, e.g. "/web/example.com/cron.php". It must exist. (minLength `1`; maxLength `1024`)
  - `task.php_version` (string | null) - For type php_script: the PHP version, one of php_version_list from manitu_webhosting_web_cronjob_list (e.g. "php8.3"); null: the package's default. (maxLength `32`)
- `schedule` (string) - When it runs, in Europe/Berlin: a cron expression - minute hour day-of-month month day-of-week, e.g. "30 3 * * *" (daily 3:30), "*/15 * * * *", "0 8-18 * * mon-fri" - or @hourly, @daily, @weekly, @monthly, @yearly. Not more often per hour than runs_per_hour_max of manitu_webhosting_web_cronjob_list allows. (minLength `1`; maxLength `255`)
- `status` (string) - active, or inactive to switch it off without deleting it. Default when created: active. (one of `"active"`, `"inactive"`)
- `description` (string | null) - The customer's description - also $DESCRIPTION in the report mail. Left out: unchanged (set) or none (create); null or empty: none. (maxLength `1024`)
- `report` (object) - Whom it tells about a run, and how. In set, only the fields given change.
  - `report.reason` (string) - When the customer is told about a run: never, onerror (exit code not 0), always. Default when created: never. (one of `"never"`, `"onerror"`, `"always"`)
  - `report.type` (string) - How: mail (needs mail.recipient), or logfile (a line in logs/cron.log of the package). Default when created: mail. (one of `"mail"`, `"logfile"`)
  - `report.mail` (object) - The report mail - for type mail.
    - `report.mail.recipient` (string) - Who gets the report mail. (maxLength `255`)
    - `report.mail.subject` (string) - The subject. Placeholders: $DESCRIPTION, $CMD_EXIT_CODE, $CMD_EXIT_STATUS, $CMD_OUTPUT_STDOUT, $CMD_OUTPUT_STDERR, $CMD_DURATION. Default when created: "[Cronjob] $DESCRIPTION: $CMD_EXIT_STATUS". (minLength `1`; maxLength `255`)
    - `report.mail.body` (string) - The text, with the same placeholders. Default when created: exit code, duration and output (German). (minLength `1`; maxLength `4096`)

### Example

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "manitu_webhosting_web_cronjob_set",
    "arguments": {
      "site_id": 12345,
      "cronjob_id": 12345
    }
  }
}
```

## REST

`POST https://api.manitu.de/v1/webhosting/web/cronjob/set`

### Authentication

One of `X-API-Key`, `Authorization: Bearer …` - never more than one in a request.

### Request body

JSON; unknown fields are refused.

- `site_id` (integer | string, required) - The site_id from manitu_webhosting_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `cronjob_id` (integer | string, required) - The cronjob_id from manitu_webhosting_web_cronjob_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `task` (object) - What it runs: type, and the one field that type uses. When the type changes, that field has to come along. In set, only the fields given change.
  - `task.type` (string) - What it runs: command (a shell command, with command), url (calls a URL, with url), php_script (a PHP file of the package, with script_path). (one of `"command"`, `"url"`, `"php_script"`)
  - `task.command` (string) - For type command: the command, run with bash as the package's user in its root directory. Only letters, digits, space and _ - " ' . / : = + - no redirection (> >> 2>), no pipe, nothing sent to the background, no ; or &&. For output use the report instead. (minLength `1`; maxLength `1024`)
  - `task.url` (string) - For type url: the URL called (http or https) - reachable without login or IP restriction, answering with status 200. (minLength `1`; maxLength `2048`)
  - `task.script_path` (string) - For type php_script: the PHP file, relative to the package, e.g. "/web/example.com/cron.php". It must exist. (minLength `1`; maxLength `1024`)
  - `task.php_version` (string | null) - For type php_script: the PHP version, one of php_version_list from manitu_webhosting_web_cronjob_list (e.g. "php8.3"); null: the package's default. (maxLength `32`)
- `schedule` (string) - When it runs, in Europe/Berlin: a cron expression - minute hour day-of-month month day-of-week, e.g. "30 3 * * *" (daily 3:30), "*/15 * * * *", "0 8-18 * * mon-fri" - or @hourly, @daily, @weekly, @monthly, @yearly. Not more often per hour than runs_per_hour_max of manitu_webhosting_web_cronjob_list allows. (minLength `1`; maxLength `255`)
- `status` (string) - active, or inactive to switch it off without deleting it. Default when created: active. (one of `"active"`, `"inactive"`)
- `description` (string | null) - The customer's description - also $DESCRIPTION in the report mail. Left out: unchanged (set) or none (create); null or empty: none. (maxLength `1024`)
- `report` (object) - Whom it tells about a run, and how. In set, only the fields given change.
  - `report.reason` (string) - When the customer is told about a run: never, onerror (exit code not 0), always. Default when created: never. (one of `"never"`, `"onerror"`, `"always"`)
  - `report.type` (string) - How: mail (needs mail.recipient), or logfile (a line in logs/cron.log of the package). Default when created: mail. (one of `"mail"`, `"logfile"`)
  - `report.mail` (object) - The report mail - for type mail.
    - `report.mail.recipient` (string) - Who gets the report mail. (maxLength `255`)
    - `report.mail.subject` (string) - The subject. Placeholders: $DESCRIPTION, $CMD_EXIT_CODE, $CMD_EXIT_STATUS, $CMD_OUTPUT_STDOUT, $CMD_OUTPUT_STDERR, $CMD_DURATION. Default when created: "[Cronjob] $DESCRIPTION: $CMD_EXIT_STATUS". (minLength `1`; maxLength `255`)
    - `report.mail.body` (string) - The text, with the same placeholders. Default when created: exit code, duration and output (German). (minLength `1`; maxLength `4096`)

### Response

In `data`; the rest of the body as on every call.

- `cronjob_id` (integer, required) - The cronjob - what the other cronjob tools take.
- `description` (string | null, required) - What the customer wrote about it (his description), null if nothing - not its name or user name.
- `status` (string, required) - active, or inactive (switched off by the customer, kept for later). (one of `"active"`, `"inactive"`)
- `task` (object, required) - What it runs - type, and only the field(s) that type uses.
  - `task.type` (string | null, required) - command (a shell command), url (calls a URL), php_script (a PHP file of the package). (one of `"command"`, `"url"`, `"php_script"`, `null`)
  - `task.command` (string | null) - For type command: the shell command - runs as the package's user, in its root directory.
  - `task.url` (string | null) - For type url: the URL called.
  - `task.script_path` (string | null) - For type php_script: the PHP file, relative to the package.
  - `task.php_version` (string | null) - For type php_script: the PHP version (e.g. "php8.3"); null: the package's default.
- `schedule` (string | null, required) - When it runs - a cron expression (minute hour day-of-month month day-of-week), in Europe/Berlin. null only if what is stored cannot be read.
- `schedule_type` (string | null, required) - How the customer panel shows the schedule: minutely, hourly, daily, weekly, monthly, yearly, or crontab (anything else).
- `runs_per_hour_max` (integer | null, required) - How often it runs in one hour at most.
- `next_run_at` (string | null, required) - When it runs next; null if inactive or never. (format `date-time`)
- `report` (object, required) - Whom it tells about a run, and how.
  - `report.reason` (string | null, required) - When the customer is told about a run: never, onerror (exit code not 0), always. (one of `"never"`, `"onerror"`, `"always"`, `null`)
  - `report.type` (string | null, required) - How: mail, or logfile (a line in logs/cron.log of the package). (one of `"mail"`, `"logfile"`, `null`)
  - `report.mail` (object | null, required) - The report mail - null unless type is mail.
    - `report.mail.recipient` (string | null, required) - Who gets the report mail.
    - `report.mail.subject` (string | null, required) - Its subject, with placeholders.
    - `report.mail.body` (string | null, required) - Its text, with placeholders.
- `last_run` (object | null, required) - Its last run; null if it has not run yet.
  - `last_run.exit_code` (integer | null, required) - Its exit code - 0 is success, 127 "command not found"; a run stopped at the time limit often shows 9 or 137.
  - `last_run.started_at` (string | null, required) - When it started. (format `date-time`)
  - `last_run.ended_at` (string | null, required) - When it ended. (format `date-time`)
  - `last_run.duration_seconds` (number | null, required) - How long it ran.
- `created_at` (string | null, required) - When it was created. (format `date-time`)
- `run_list` (array of object, required) - Its last runs, newest first (at most 25) - with what it wrote.
  - `run_list[].exit_code` (integer | null, required) - Its exit code - 0 is success, 127 "command not found"; a run stopped at the time limit often shows 9 or 137.
  - `run_list[].started_at` (string | null, required) - When it started. (format `date-time`)
  - `run_list[].ended_at` (string | null, required) - When it ended. (format `date-time`)
  - `run_list[].duration_seconds` (number | null, required) - How long it ran.
  - `run_list[].stdout` (string | null, required) - What it wrote to standard output - the first 1024 characters.
  - `run_list[].stderr` (string | null, required) - What it wrote to standard error - the first 1024 characters.

### Statuses

- `200` Success.
- `400` The request does not match the declared input schema.
- `401` No credential was presented, or it was not recognised.
- `403` The credential is not permitted to use this operation.
- `500` The server failed. Nothing about the request was wrong. Whether a change took effect is not known - check before trying it again.
- `503` The channel this operation forwards through is unavailable.

### Example

```sh
curl -X POST 'https://api.manitu.de/v1/webhosting/web/cronjob/set' \
  -H 'X-API-Key: $API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"site_id":12345,"cronjob_id":12345}'
```

## Example result

```json
{
  "cronjob_id": 12345,
  "description": "Example",
  "status": "active",
  "task": {
    "type": "command",
    "command": "string",
    "url": "https://www.example.com/",
    "script_path": "/web",
    "php_version": "string"
  },
  "schedule": "string",
  "schedule_type": "string",
  "runs_per_hour_max": 1,
  "next_run_at": "2026-10-23T12:00:00+02:00",
  "report": {
    "reason": "never",
    "type": "mail",
    "mail": {
      "recipient": "string",
      "subject": "string",
      "body": "string"
    }
  },
  "last_run": {
    "exit_code": 1,
    "started_at": "2026-10-23T12:00:00+02:00",
    "ended_at": "2026-10-23T12:00:00+02:00",
    "duration_seconds": 1.5
  },
  "created_at": "2026-10-23T12:00:00+02:00",
  "run_list": [
    {
      "exit_code": 1,
      "started_at": "2026-10-23T12:00:00+02:00",
      "ended_at": "2026-10-23T12:00:00+02:00",
      "duration_seconds": 1.5,
      "stdout": "string",
      "stderr": "string"
    }
  ]
}
```
