CronDrive

Set up CronDrive with an AI agent

An agent that works on your server, like Claude Code, Cursor or Codex, can read your crontab, create a job for each line and add the calls to CronDrive. You approve the new crontab before anything changes.

Paste this in Claude Code, Cursor, Codex or your AI agent:

Set up CronDrive to monitor the cron jobs on this server. Follow the instructions at https://crondrive.com/docs/agents

Prefer to do it yourself? Follow the quickstart.

Instructions for the agent

You are helping the user monitor the cron jobs of the server you work on with CronDrive. CronDrive alerts the user when a job fails, or doesn't start or finish on time. Follow these steps, and ask the user before changing the crontab.

  1. 1. Connect to CronDrive's MCP server

    The server is https://crondrive.com/mcp, over HTTP, and the user logs in with OAuth. If you don't have its tools yet (create_job, resume_job), add it. In Claude Code, run:

    claude mcp add --transport http --scope user crondrive https://crondrive.com/mcp

    Then ask the user to run /mcp, choose crondrive and log in to CronDrive, or sign up if they don't have an account. If crondrive isn't listed, they need to restart Claude Code first.

    In other agents, add a remote MCP server with that URL. If the agent can't log in with OAuth, the user creates a token in https://crondrive.com/users/settings/agents and the agent sends it in the header Authorization: Bearer <token>.

  2. 2. Read the crontab and its time zone

    Read the user's crontab with crontab -l and, if you have access, /etc/crontab, /etc/cron.d. Cron uses the time zone in CRON_TZ if the crontab sets it; if not, the server's: timedatectl | grep "Time zone", or /etc/timezone.

  3. 3. Create a job for each line

    Call create_job for each line with a schedule: a short name the user will recognize in the alerts, the first five fields as the cron expression, the time zone, the command, and how many minutes to wait for it to finish, with a margin over how long it usually takes. Skip @reboot lines.

    The jobs are created paused, so nothing alerts yet. The free plan monitors up to 15 jobs.

  4. 4. Change the crontab, once the user approves

    create_job returns each job's crontab_line: the same schedule and command, between a call to CronDrive when it starts and another when it ends, with its exit code. Save a copy of the current crontab, show the user the change and, once they approve it, replace each line with its crontab_line. Leave the rest of the crontab as it is.

  5. 5. Turn on monitoring

    Call resume_job for each job. CronDrive alerts the user by email, and on Slack if they connect it. Tell the user which jobs are monitored and that they can see their runs at https://crondrive.com/jobs.