Create cronjob for a web hosting package
A new cronjob for one web hosting package - a command, a URL or a PHP script, run on a schedule.
manitu_webhosting_web_cronjob_create on https://mcp.manitu.de/mcpAnnotations as tools/list sends them
Description for the model
Creates a cronjob for a web hosting package of the manitu customer account this connection works in, by its site_id from manitu_webhosting_list: task (its type with command, url or script_path) and schedule, a cron expression in Europe/Berlin. Check runs_per_hour_max, count_max and php_version_list in manitu_webhosting_web_cronjob_list first. A command takes only letters, digits, space and _ - " ' . / : = + - no redirection, pipe, ; or &&: to keep the output, set report (reason, and type mail with mail.recipient, or logfile) instead. A run is stopped at runtime_seconds_max. Refused with a conflict when the package allows no more cronjobs (limit_reached) or cannot be changed now (not_configurable). It is active a few minutes later. Tell the customer what will run when and ask for an explicit yes first.
Arguments
site_idinteger | stringrequiredThe site_id from manitu_webhosting_list - never guess one.
taskobjectrequiredWhat 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.typestringWhat 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).
task.commandstringFor 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.
task.urlstringFor type url: the URL called (http or https) - reachable without login or IP restriction, answering with status 200.
task.script_pathstringFor type php_script: the PHP file, relative to the package, e.g. "/web/example.com/cron.php". It must exist.
task.php_versionstring | nullFor 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.
schedulestringrequiredWhen 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.
statusstringactive, or inactive to switch it off without deleting it. Default when created: active.
descriptionstring | nullThe customer's description - also $DESCRIPTION in the report mail. Left out: unchanged (set) or none (create); null or empty: none.
reportobjectWhom it tells about a run, and how. In set, only the fields given change.
report.reasonstringWhen the customer is told about a run: never, onerror (exit code not 0), always. Default when created: never.
report.typestringHow: mail (needs mail.recipient), or logfile (a line in logs/cron.log of the package). Default when created: mail.
report.mailobjectThe report mail - for type mail.
report.mail.recipientstringWho gets the report mail.
report.mail.subjectstringThe 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".
report.mail.bodystringThe text, with the same placeholders. Default when created: exit code, duration and output (German).
Result structuredContent, checked against the schema
cronjob_idintegerrequiredThe cronjob - what the other cronjob tools take.
descriptionstring | nullrequiredWhat the customer wrote about it (his description), null if nothing - not its name or user name.
statusstringrequiredactive, or inactive (switched off by the customer, kept for later).
taskobjectrequiredWhat it runs - type, and only the field(s) that type uses.
task.typestring | nullrequiredcommand (a shell command), url (calls a URL), php_script (a PHP file of the package).
task.commandstring | nullFor type command: the shell command - runs as the package's user, in its root directory.
task.urlstring | nullFor type url: the URL called.
task.script_pathstring | nullFor type php_script: the PHP file, relative to the package.
task.php_versionstring | nullFor type php_script: the PHP version (e.g. "php8.3"); null: the package's default.
schedulestring | nullrequiredWhen 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_typestring | nullrequiredHow the customer panel shows the schedule: minutely, hourly, daily, weekly, monthly, yearly, or crontab (anything else).
runs_per_hour_maxinteger | nullrequiredHow often it runs in one hour at most.
next_run_atstring | nullrequiredWhen it runs next; null if inactive or never.
reportobjectrequiredWhom it tells about a run, and how.
report.reasonstring | nullrequiredWhen the customer is told about a run: never, onerror (exit code not 0), always.
report.typestring | nullrequiredHow: mail, or logfile (a line in logs/cron.log of the package).
report.mailobject | nullrequiredThe report mail - null unless type is mail.
report.mail.recipientstring | nullrequiredWho gets the report mail.
report.mail.subjectstring | nullrequiredIts subject, with placeholders.
report.mail.bodystring | nullrequiredIts text, with placeholders.
last_runobject | nullrequiredIts last run; null if it has not run yet.
last_run.exit_codeinteger | nullrequiredIts exit code - 0 is success, 127 "command not found"; a run stopped at the time limit often shows 9 or 137.
last_run.started_atstring | nullrequiredWhen it started.
last_run.ended_atstring | nullrequiredWhen it ended.
last_run.duration_secondsnumber | nullrequiredHow long it ran.
created_atstring | nullrequiredWhen it was created.
run_listarray of objectrequiredIts last runs, newest first (at most 25) - with what it wrote.
run_list[].exit_codeinteger | nullrequiredIts exit code - 0 is success, 127 "command not found"; a run stopped at the time limit often shows 9 or 137.
run_list[].started_atstring | nullrequiredWhen it started.
run_list[].ended_atstring | nullrequiredWhen it ended.
run_list[].duration_secondsnumber | nullrequiredHow long it ran.
run_list[].stdoutstring | nullrequiredWhat it wrote to standard output - the first 1024 characters.
run_list[].stderrstring | nullrequiredWhat it wrote to standard error - the first 1024 characters.
Authentication
One of X-API-Key, Authorization: Bearer … - never more than one in a request. More
Request body JSON; unknown fields are refused
site_idinteger | stringrequiredThe site_id from manitu_webhosting_list - never guess one.
taskobjectrequiredWhat 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.typestringWhat 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).
task.commandstringFor 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.
task.urlstringFor type url: the URL called (http or https) - reachable without login or IP restriction, answering with status 200.
task.script_pathstringFor type php_script: the PHP file, relative to the package, e.g. "/web/example.com/cron.php". It must exist.
task.php_versionstring | nullFor 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.
schedulestringrequiredWhen 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.
statusstringactive, or inactive to switch it off without deleting it. Default when created: active.
descriptionstring | nullThe customer's description - also $DESCRIPTION in the report mail. Left out: unchanged (set) or none (create); null or empty: none.
reportobjectWhom it tells about a run, and how. In set, only the fields given change.
report.reasonstringWhen the customer is told about a run: never, onerror (exit code not 0), always. Default when created: never.
report.typestringHow: mail (needs mail.recipient), or logfile (a line in logs/cron.log of the package). Default when created: mail.
report.mailobjectThe report mail - for type mail.
report.mail.recipientstringWho gets the report mail.
report.mail.subjectstringThe 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".
report.mail.bodystringThe text, with the same placeholders. Default when created: exit code, duration and output (German).
Response in data; the rest of the body as on every call
cronjob_idintegerrequiredThe cronjob - what the other cronjob tools take.
descriptionstring | nullrequiredWhat the customer wrote about it (his description), null if nothing - not its name or user name.
statusstringrequiredactive, or inactive (switched off by the customer, kept for later).
taskobjectrequiredWhat it runs - type, and only the field(s) that type uses.
task.typestring | nullrequiredcommand (a shell command), url (calls a URL), php_script (a PHP file of the package).
task.commandstring | nullFor type command: the shell command - runs as the package's user, in its root directory.
task.urlstring | nullFor type url: the URL called.
task.script_pathstring | nullFor type php_script: the PHP file, relative to the package.
task.php_versionstring | nullFor type php_script: the PHP version (e.g. "php8.3"); null: the package's default.
schedulestring | nullrequiredWhen 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_typestring | nullrequiredHow the customer panel shows the schedule: minutely, hourly, daily, weekly, monthly, yearly, or crontab (anything else).
runs_per_hour_maxinteger | nullrequiredHow often it runs in one hour at most.
next_run_atstring | nullrequiredWhen it runs next; null if inactive or never.
reportobjectrequiredWhom it tells about a run, and how.
report.reasonstring | nullrequiredWhen the customer is told about a run: never, onerror (exit code not 0), always.
report.typestring | nullrequiredHow: mail, or logfile (a line in logs/cron.log of the package).
report.mailobject | nullrequiredThe report mail - null unless type is mail.
report.mail.recipientstring | nullrequiredWho gets the report mail.
report.mail.subjectstring | nullrequiredIts subject, with placeholders.
report.mail.bodystring | nullrequiredIts text, with placeholders.
last_runobject | nullrequiredIts last run; null if it has not run yet.
last_run.exit_codeinteger | nullrequiredIts exit code - 0 is success, 127 "command not found"; a run stopped at the time limit often shows 9 or 137.
last_run.started_atstring | nullrequiredWhen it started.
last_run.ended_atstring | nullrequiredWhen it ended.
last_run.duration_secondsnumber | nullrequiredHow long it ran.
created_atstring | nullrequiredWhen it was created.
run_listarray of objectrequiredIts last runs, newest first (at most 25) - with what it wrote.
run_list[].exit_codeinteger | nullrequiredIts exit code - 0 is success, 127 "command not found"; a run stopped at the time limit often shows 9 or 137.
run_list[].started_atstring | nullrequiredWhen it started.
run_list[].ended_atstring | nullrequiredWhen it ended.
run_list[].duration_secondsnumber | nullrequiredHow long it ran.
run_list[].stdoutstring | nullrequiredWhat it wrote to standard output - the first 1024 characters.
run_list[].stderrstring | nullrequiredWhat it wrote to standard error - the first 1024 characters.
Statuses
200Success.400The request does not match the declared input schema.401No credential was presented, or it was not recognised.403The credential is not permitted to use this operation.500The server failed. Nothing about the request was wrong. Whether a change took effect is not known - check before trying it again.503The channel this operation forwards through is unavailable.