Skip to main content
Glama

cron_logging

Configure cron jobs to log output to rotated files and capture start, end, and exit code so fleet_schedule can show results.

Instructions

Make every cron job write its output to a log and rotate those logs. A line that already appends to a file keeps it and the file joins rotation unless another logrotate config covers it; output to /dev/null or nowhere → >> /var/log/cron/.log 2>&1; a pipe into logger stays in syslog. Rotation: /etc/logrotate.d/cron-jobs (weekly, 8 copies, compress, copytruncate). Every line also runs through /usr/local/sbin/mia-cronrun, which records start, end and exit code so fleet_schedule shows a result for cron jobs (the command itself is unchanged). Stock OS cron files are left alone; copies of touched files go to /root/mia-backup; a logrotate error after the change rolls the rotation file back. Roll out a few hosts at a time and look at fleet_schedule in between.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
applyNofalse (default) = dry run: show what will happen on which hosts and a planHash. true = run it; needs planHash
batchNohosts at a time (rolling). Default depends on the action: 1 for disruptive ones
targetNohosts: all | <host> | <glob nl-*> | <group> | role:<edge|remnanode|panel|docker> | tag:<tag>; comma-separated, !x excludesall
planHashNoplanHash from the dry run of the very same call, good for one apply; refused if targets or their state changed since
continueOnErrorNokeep going after a host fails (default: stop the rollout at the first failure)
skipUnreachableNoskip hosts that do not answer over ssh instead of refusing the whole plan (they show as skipped)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so well: it discloses backups to /root/mia-backup, that stock OS cron files are left alone, that the command itself is unchanged, that a logrotate error rolls the rotation file back, and the dry-run/planHash gating. This is unusually rich disclosure of side effects and reversibility for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded in sentence one, and the paragraph is dense with decision-relevant facts rather than filler. It is long and mixes fine-grained logrotate config detail (weekly, 8 copies, compress, copytruncate) that is arguably not needed for correct invocation, keeping it just under a 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a six-parameter mutation tool with no annotations and no output schema, the description covers what changes, what is preserved, backup location, rollback behavior, and rollout hygiene. Nothing an agent needs in order to call this safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so apply/planHash/target/batch/continueOnError/skipUnreachable are all documented in the schema itself. The description adds only indirect hints ('Roll out a few hosts at a time' gestures at batch, 'a pipe into logger stays in syslog' at line handling) but no new parameter syntax or semantics, which matches the baseline 3 when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence states a specific verb+resource with measurable outcome ('make every cron job write its output to a log and rotate those logs'), and later sentences clarify the job-vs-logrotate relationship and the fleet_schedule integration. An agent can distinguish this from siblings like fleet_schedule or host_file_edit without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives real operational guidance ('Roll out a few hosts at a time and look at fleet_schedule in between') and describes how existing lines are treated, so the agent knows the intended change process. It stops short of naming when NOT to use this (e.g. vs. host_file_edit for manual cron edits), so no explicit alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.