# Using Cronitor CLI

CronitorCLI is our cross-platform, open source companion application. Run it on your workstation and deploy it to your server for powerful features, including:

**Import and sync all of your cron jobs**
Complete your integration in minutes with `cronitor sync` and sync schedule changes to Cronitor automatically.

**Manage your cron jobs from a web-based control panel**
Run `cronitor dash` to start the bundled [Crontab Guru Dashboard](#crontab-guru-dashboard), with one-click "run now", job suspension, a local test console, and a built-in [MCP server](#mcp-server-ai-integration) for AI tools.

**Easier integration with Cronitor**
Run and monitor any command with `exec` and use `ping` to send telemetry pings more reliably than curl.

**Manage your account from the terminal**
Create and update monitors, status pages, issues, notification lists, and more. Connect Slack, PagerDuty, and other alert destinations with `cronitor connect`.

**Power tools for your cron jobs**
Use `list` to view every cron job on your system. Use `shell` to test running a command like cron does.

## Installation

### Install by Script (recommended)

CronitorCLI is packaged as a single executable for Linux, macOS, and Windows. This installation script selects the right binary for your operating system and platform. Installation does not require an API key; authenticate separately after inspecting the installed command. [View Source](https://cronitor.io/install-linux?sudo=1&pretty=1)

You can re-run this script at any time to install the latest version of CronitorCLI.
[![Latest Release](https://img.shields.io/github/v/release/cronitorio/cronitor-cli?style=flat&color=brightgreen)](https://github.com/cronitorio/cronitor-cli/releases)
```bash
curl -fsSL 'https://cronitor.io/install-linux?sudo=1' | sh
cronitor help
```

The installer prints one line, then sends an anonymous ping to cronitor.link when an install starts and when it finishes. Set `CRONITOR_INSTALL_TELEMETRY=0` or `DO_NOT_TRACK=1` to send nothing. With `?sudo=1`, sudo is used only when you are not already root; as root (the usual case in a container or CI image) the same command installs without sudo.

Do not run `cronitor sync` until you have reviewed the jobs it will discover and approved the resulting Cronitor resources and crontab changes.

### Manual Installation

Download and install a prebuilt executable for your platform, or compile CronitorCLI directly from source.

#### Linux (amd64)

**Choosing an installation location**
The easiest way to integrate and use CronitorCLI is to install the binary system-wide in `/usr/bin`. If you choose an alternate install location (e.g. your home directory) you will need to remember and use its full path when running commands.

**Downloading and installing**
Paste each instruction into a terminal and execute. Because `/usr/bin` is a privileged directory you will require sudo or root access for that step. By default the CronitorCLI config file is stored in `/etc/cronitor` and you will also need sudo access to create and write this file.

```bash
curl -sOL https://cronitor.io/dl/linux_amd64.tar.gz
sudo tar xvf linux_amd64.tar.gz -C /usr/bin/
```

**Testing your installation**
To verify your installation, run `cronitor help` from your terminal.

#### macOS (Apple silicon and Intel)

The installation script above works on macOS and picks the right build for your Mac. To install by hand, download the build for your Mac and extract it to `/usr/local/bin`, which is on the default `PATH`. Writing there needs sudo. By default the CronitorCLI config file is stored in `/etc/cronitor`, which also needs sudo to create.

Apple silicon (M1 and later):

```bash
curl -sOL https://cronitor.io/dl/darwin_arm64.tar.gz
sudo tar xvf darwin_arm64.tar.gz -C /usr/local/bin/
```

Intel:

```bash
curl -sOL https://cronitor.io/dl/darwin_amd64.tar.gz
sudo tar xvf darwin_amd64.tar.gz -C /usr/local/bin/
```

Run `uname -m` if you are not sure: `arm64` is Apple silicon and `x86_64` is Intel.

**Testing your installation**
To verify your installation, run `cronitor help` from your terminal.

#### Windows

1. Download application: [https://cronitor.io/dl/windows_amd64.zip](https://cronitor.io/dl/windows_amd64.zip)
2. Unzip and move the executable to `%ProgramFiles%\` for system-wide use
3. Run `%ProgramFiles%\cronitor.exe help` from PowerShell or cmd.

**Testing your installation**
To verify your installation, run `%ProgramFiles%\cronitor.exe` from powershell. A usage block will be printed to your screen.

#### More Options

**Download an executable**
CronitorCLI builds for multiple platforms and operating systems can be found on our Github Release page:
[https://github.com/cronitorio/cronitor-cli/releases](https://github.com/cronitorio/cronitor-cli/releases)

**Verify a build**
MD5 and SHA256 hashes for every build are available on our Github Release page:
[https://github.com/cronitorio/cronitor-cli/releases](https://github.com/cronitorio/cronitor-cli/releases)

**Installing from source**
[View on Github](https://github.com/cronitorio/cronitor-cli)

After installation, inspect `cronitor help` before authenticating or changing cron jobs.

## Authentication

Sign in or create a Cronitor account from the terminal:

```bash
cronitor auth login
cronitor auth status
```

Login opens a browser using OAuth authorization code with PKCE. Sign in with your existing account, or create one in the same browser step with Google, GitHub, or email and password. Organization-required SAML still applies to existing accounts. When the browser returns to the CLI's local callback, the CLI saves a named machine credential in its config file. `cronitor signup` is an alias for `cronitor auth login`.

On a remote host, use `cronitor auth login --no-browser` in an interactive terminal. Open the displayed authorization URL in your browser and sign in. The browser redirects to `http://127.0.0.1:8319/callback?...`; a connection error is expected when the browser is on another machine. Copy the full resulting URL from the address bar and paste it directly into the waiting CLI prompt. No SSH tunnel is required. The prompt hides the pasted URL; do not paste it into an agent conversation, logs, or an issue. Passwords and provider credentials stay in the browser.

If `cronitor auth login` shows a user code instead of opening a browser, update the CLI. Existing API-key configurations continue to work and do not need to be replaced.

### Account access

```bash
cronitor auth login --admin
```

`--admin` gives the credential account access. That lets this machine run `cronitor team` and `cronitor apikey`. On those commands the credential acts as you, with your current role.

Use `--admin` on your own workstation for admin tasks. Do not use it on a shared server or a CI host: anyone who can read the config file can act as you.

`cronitor auth status` shows whether the credential has account access. It does not print the key.

Removing a member revokes the credentials they created with `--admin`. Their other CLI credentials are organization-owned SDK Integration or telemetry keys and keep working so monitoring on those hosts continues; delete them with `cronitor apikey delete` or in the dashboard if needed. Changing a member's role revokes nothing. On team and API key commands an `--admin` credential acts with the user's current role; on every other command it keeps the scopes it was created with, so after demoting someone, delete their keys and have them log in again.

### Config ownership and persistent access

Login stores a long-lived credential for this installation, not the temporary WorkOS tokens. It restricts the config file to its owner (`0600` on Unix; an owner-restricted ACL on Windows). The default config location is `/etc/cronitor/cronitor.json` on Linux/macOS and `%SystemDrive%\ProgramData\Cronitor\cronitor.json` on Windows. Choose a writable path and the OS user that should own it before login. For example, on Linux/macOS:

```bash
mkdir -p "$HOME/.config/cronitor"
export CRONITOR_CONFIG="$HOME/.config/cronitor/cronitor.json"
cronitor auth login --no-browser
cronitor auth status
cronitor monitor list
```

Use that same `CRONITOR_CONFIG` or `--config` path for subsequent commands. Scheduled jobs running as another OS user need their own credential/config or credentials supplied through their service environment.

`auth status` reports the machine credential's organization, permissions, and whether it has account access, without printing the key. Full-access users receive an SDK Integration credential; read-only users receive telemetry-only access and cannot manage account resources. Integration writes use `integration:write` (included on SDK Integration keys). See the [Integrations API](https://cronitor.io/docs/integrations-api.md).

To revoke this installation's credential and remove it locally:

```bash
cronitor auth logout
```

Jobs using that credential will stop authenticating. Do not log out as routine cleanup after an agent task if monitoring depends on it. Replacing a credential with another login does not revoke the previous one; remove unused keys in the dashboard. Removing a member revokes the credentials they created with `--admin`. Their other CLI credentials are organization-owned SDK Integration or telemetry keys and keep working so monitoring on those hosts continues; delete them with `cronitor apikey delete` or in the dashboard if needed. Changing a member's role revokes nothing. On team and API key commands an `--admin` credential acts with the user's current role; on every other command it keeps the scopes it was created with, so after demoting someone, delete their keys and have them log in again.

### CI and explicit API keys

For CI, containers, and deployments using a secret manager, provide `CRONITOR_API_KEY` through your existing secret injector. Use the SDK Integration key; it covers both monitor management and telemetry. Never put a literal key in `--api-key`, a copied command, source control, shell history, logs, tickets, screenshots, or agent conversations. `cronitor configure` can persist configuration when needed.

## Usage

### Command Reference

```bash
cronitor help
cronitor <command> --help
```

Use the installed command's help as the command reference; it stays aligned with that binary's version and available resource commands.

### Cron management

| Command | Description |
| --- | --- |
| `cronitor sync [path]` | Add monitoring to new cron jobs and sync schedule changes to existing jobs |
| `cronitor sync --format=short` | Also convert `cronitor exec` lines to `CRONITOR=<key>` lines |
| `cronitor sync --format=exec` | Write all monitored lines as `cronitor exec` and restore your `SHELL` |
| `cronitor sync --with-monitored` | Also ask about jobs that are already monitored, for example to rename them |
| `cronitor sync --dry-run` | On Linux and macOS, preview crontab changes without sending monitor updates, writing the crontab or installing the shell shim |
| `cronitor exec <key> <cmd>` | Run a command with monitoring |
| `cronitor ping <key>` | Send a telemetry event (`--run`, `--complete`, `--fail`, `--ok`, `--tick`) |
| `cronitor list [path]` | List all cron jobs found on this system, or in a crontab file or directory |
| `cronitor status [key]` | View monitor status for your account or a single monitor |
| `cronitor shell` | Run commands from a cron-like shell to reproduce cron's environment |
| `cronitor dash` | Start the [web dashboard](#crontab-guru-dashboard) |
| `cronitor configure` | Save configuration variables to the config file |
| `cronitor update` | Update CronitorCLI to the latest version |

### How sync changes a crontab

On Linux and macOS, `cronitor sync` puts the monitor key in front of each job you choose to monitor, and adds one line to the top of the crontab:

```
SHELL=/etc/cronitor/shell
0 1 * * * CRONITOR=abc123 /usr/local/bin/backup.sh
```

- A `CRONITOR=<key> <command>` line runs exactly like `cronitor exec <key> <command>`: same shell, telemetry, output and exit code.
- `/etc/cronitor/shell` is a small script. Cron starts every job with it. For a line that starts with `CRONITOR=<key>`, it runs `cronitor exec`. Every other line runs in `/bin/sh`, unchanged.
- If the crontab already had a `SHELL=` line, sync keeps that shell as `CRONITOR_SHELL=` (for example `CRONITOR_SHELL=/bin/zsh`), and jobs keep running in it.
- Sync installs the script in `/etc/cronitor/` when it runs as root, and in `~/.cronitor/` otherwise.
- If the `cronitor` binary is missing, monitored jobs still run, without telemetry.
- Lines that start with `MONITORIO=<key>` work the same way.
- Sync leaves existing `cronitor exec` lines as they are. Run `cronitor sync --format=short` to convert them. These flags move to settings on the line: `--no-stdout` (`CRONITOR_NO_STDOUT=1`), `--env` (`CRONITOR_ENV`), `--api-key` (`CRONITOR_API_KEY`), `--ping-api-key` (`CRONITOR_PING_API_KEY`) and `--hostname` (`CRONITOR_HOSTNAME`). A line with any other flag stays `cronitor exec`. A converted job runs the same as before.

  ```
  0 1 * * * CRONITOR=abc123 CRONITOR_ENV=staging CRONITOR_NO_STDOUT=1 /usr/local/bin/backup.sh
  ```

- `cronitor sync --no-stdout`, `--env`, `--api-key` and `--hostname` write new jobs as `cronitor exec`.
- A `CRONITOR=<key>` line works only in a crontab that sync has changed. To add monitoring by hand to another crontab, a script, a container or a scheduled task, use `cronitor exec <key> <cmd>`.
- To go back to `cronitor exec` lines, run `cronitor sync --format=exec`.
- Windows scheduled tasks always use `cronitor exec`.

### Running sync again

There are three ways to run sync on Linux and macOS:

| Command | Asks about | Picks up schedule and timezone changes | Monitors new jobs |
| --- | --- | --- | --- |
| `cronitor sync` | new jobs only | yes | the ones you choose |
| `cronitor sync --with-monitored` | every job, so you can rename one | yes | the ones you choose |
| `cronitor sync --auto` | nothing | yes | all of them |

- Run plain `cronitor sync` again whenever you add jobs or change a schedule. Before it sends or writes anything, it shows one summary for each crontab, with a line for each change (for example `L3  Nightly backup: schedule 0 2 * * * → 30 3 * * *`), and asks once. If nothing changed, it says so and asks nothing.
- `--auto` is for scripts and pipelines. It asks no questions and has no Apply prompt. It also monitors every new job, so it is not the way to pick up one schedule change. With a single crontab file, it prints the crontab to stdout even when nothing changed or with `--dry-run`, so `cronitor sync --auto file | crontab -` does not install an empty crontab on an unchanged rerun. `--silent` suppresses that output.
- `--auto --dry-run` prints the summary to stderr and the crontab to stdout. It sends no monitor updates, writes no crontab and installs no shell shim. Without `--auto`, a dry run still asks about new jobs and shows the summary, but has no Apply prompt. This preview behavior applies to Linux and macOS crontabs: `sync --file` still imports monitors, and Windows sync still sends monitors but does not rewrite tasks. If your CLI still sends monitors on a dry run, run `cronitor update` first.
- `--silent` hides status messages. Without `--auto`, it still asks the per-job questions for new jobs and asks `Apply these changes?`. With `--auto`, there are no questions and no crontab on stdout.
- For a job that is already monitored, sync sends only what changed: the schedule, the timezone (from `CRON_TZ`, `TZ` or the server), and the alert list when you pass `--notification-list`. Without `--notification-list`, existing alert lists are kept and new monitors get the default list.
- Names, tags and notes you set in Cronitor are kept. If the line has a `# Name:` comment with a different name, sync updates the comment to the name in Cronitor.
- If a monitor was deleted in Cronitor, sync warns and does not create it again. A hand-written line such as `CRONITOR=new-key` is treated the same way when that monitor does not exist; sync does not create it.
- If sync cannot load the monitor list, an interactive run asks about every job. With `--auto`, it sends each monitored job's schedule and does not rename monitors.
- In the menu, Enter selects, `s` skips, and `q`, Esc, Ctrl+C or Ctrl+D quits. While typing a name, `s` and `q` are letters, Esc goes back, and Ctrl+C or Ctrl+D quits. If you quit with pending changes, sync prints the summary, then asks `Save what you've done so far? [y/N]`. The default is no.
- "Skip this job, don't ask again" adds `# cronitor: ignore` above the line. Sync skips that job from then on. A job that is already monitored keeps reporting, but sync stops updating it. Delete the comment to undo.
- When sync cannot write system crontabs, it skips them and prints one hint at the end telling you to rerun with `sudo`.
- If any crontab fails to apply, sync exits 1. With `--auto` and a single crontab file, a failed shell-wrapper install or crontab save prints the original crontab, so `| crontab -` reinstalls a working crontab.

### Account resource commands

CronitorCLI manages the same account resources exposed by Cronitor's API. The installed command's `--help` output is authoritative for its version.

| Resource | Command | Common operations |
| --- | --- | --- |
| Monitors | `cronitor monitor` | `list`, `search`, `get`, `export`, `create`, `update`, `delete`, `clone`, `pause`, `unpause` |
| Status pages | `cronitor statuspage` | `list`, `get`, `create`, `update`, `delete`; manage components with `statuspage component` |
| Issues | `cronitor issue` | `list`, `get`, `create`, `update`, `resolve`, `delete`, `bulk` |
| Notification lists | `cronitor notification` | `list`, `get`, `create`, `update`, `delete` |
| Integrations | `cronitor integration` | `list`, `get`, `services`, `create`, `delete`; connect interactively with [`cronitor connect`](#integrations) |
| Groups | `cronitor group` | `list`, `get`, `create`, `update`, `delete`, `pause`, `resume` |
| Environments | `cronitor environment` | `list`, `get`, `create`, `update`, `delete` |
| Maintenance windows | `cronitor maintenance` | `list`, `get`, `create`, `update`, `delete` |
| Metrics | `cronitor metric` | `get`, `aggregate` |
| RUM sites | `cronitor site` | `list`, `get`, `create`, `update`, `delete`, `query`; list and inspect JavaScript errors with `site error` |
| Team | `cronitor team` | `list`, `invite`, `role`, `remove` |
| API keys | `cronitor apikey` | `list`, `get`, `create`, `update`, `delete` |

Representative examples:

```bash
cronitor monitor list --type job --state failing
cronitor monitor list --tag critical --env production
cronitor monitor export -o monitors.yaml
cronitor monitor get billing-rollup --with-events
cronitor monitor create --file monitors.yaml
cronitor monitor update billing-rollup --data '{"name":"Billing rollup"}'
cronitor monitor pause billing-rollup --hours 24
cronitor monitor delete key1 key2 key3
cronitor statuspage get company-status --with-components
cronitor statuspage component list --statuspage company-status
cronitor issue list --state unresolved --severity outage
cronitor issue update ISSUE_KEY --data '{"state":"investigating"}'
cronitor issue resolve ISSUE_KEY
cronitor notification list
cronitor group list --with-status
cronitor group pause production-jobs 24
cronitor environment list
cronitor maintenance list --upcoming
cronitor metric aggregate --monitor billing-rollup --time 30d
cronitor site error list --site web-app
```

#### Team

```bash
cronitor team list
cronitor team list --format json
cronitor team invite jane@example.com --name "Jane Doe"        # Role defaults to user
cronitor team invite ops@example.com --name "Ops" --role readonly
cronitor team role jane@example.com admin                      # admin, user, or readonly
cronitor team remove jane@example.com                          # Asks first; --yes skips
```

#### API keys

```bash
cronitor apikey list                                           # Table masks each key
cronitor apikey list --search deploy --page 2
cronitor apikey list --format json                             # Prints full keys
cronitor apikey get <key>
cronitor apikey create --name "Deploy bot" --scope monitor:read --scope monitor:write
cronitor apikey create --name "Telemetry" --kind telemetry
cronitor apikey update <key> --name "Renamed"
cronitor apikey update <key> --scope monitor:read              # Replaces the scopes
cronitor apikey delete <key>                                   # Asks first; --yes skips
```

Team and API key commands need a credential from `cronitor auth login --admin` and act with the logged-in user's current role. Any role can list the team. Inviting, changing roles, and removing members need the admin role on a plan with team management. You can't change or remove yourself, and the owner can't be changed or removed from the CLI. Read-only users can't use `cronitor apikey` at all, even with `--admin`. A team member's id is their email address, the same value `team list` prints in the ID column. You can only grant API key scopes your own role has. `apikey create` prints the full key once. Without `--yes`, `team remove` and `apikey delete` refuse to run when stdin is not a terminal.

**Aliases:** `cronitor env` for `environment`, `cronitor notifications` for `notification`, `cronitor integrations` for `integration`, `cronitor maint` for `maintenance`, `cronitor metrics` for `metric`, `cronitor teams` for `team`, `cronitor apikeys` and `cronitor keys` for `apikey`.

Before sending a payload, read `cronitor <resource> <operation> --help` and the linked raw API documentation. The [CronitorCLI README](https://github.com/cronitorio/cronitor-cli#api-resources) contains additional examples for every resource.

### Common flags

| Flag | Description |
| --- | --- |
| `--format <json,table,yaml>` | Output format. Defaults to `table` for list commands and `json` for get commands. YAML is supported where noted in `--help`. |
| `-o, --output <file>` | Write output to a file |
| `--page <n>` | Page number for paginated results |
| `-d, --data <json>` | JSON payload for create and update commands |
| `-f, --file <path>` | Read a JSON or YAML payload from a file |
| `-k, --api-key <key>` | Cronitor API key. Appears in shell history and process lists; prefer `CRONITOR_API_KEY`. |

### Integrations

Integrations are the Slack workspaces, PagerDuty services, webhooks, and other destinations that Cronitor sends alerts to. `cronitor connect` adds one interactively; `cronitor integration` lists, inspects, creates, and deletes them.

```bash
cronitor connect                                      # List available services
cronitor connect slack                                # OAuth: print URL, open browser, wait
cronitor connect slack --no-browser                   # Print authorize URL only
cronitor connect pagerduty --timeout 10m --add-to default
cronitor connect opsgenie --name "On-call" --field key=SECRET
cronitor connect telegram                             # Print bot instructions; wait for a new label
cronitor connect telegram --name "On-call bot"        # Wait for a new label that matches
```

`cronitor connect` behaves differently depending on the service:

- **OAuth services** (`slack`, `pagerduty`): starts a connect session, prints the authorize URL, opens a browser unless `--no-browser` is set, then polls until the integration is complete. `--timeout` (default `15m`) bounds the wait.
- **API-key services** (`discord`, `microsoft-teams`, `gchat`, `larksuite`, `opsgenie`, `victorops`, `datadog-on-call`, `webhook`): prompts for each field unless it is supplied with `--field key=value`, then creates the integration. Secret values are not echoed. Omit `--field` to be prompted; values passed with `--field` are visible in shell history.
- **Telegram**: prints bot instructions and waits for a new Telegram integration to appear on the account. If `--name` is set, the new integration's label must match it.

Pass `--add-to <notification list key>` to append the new integration to a notification list once it is connected. Service names are the catalogue keys shown by `cronitor connect` and `cronitor integration services`; friendly aliases are not accepted.

```bash
cronitor integration list
cronitor integration list --service slack
cronitor integration get Workspace
cronitor integration get Alerts --service slack
cronitor integration services
cronitor integration create --service discord --name "Alerts" --field key=https://example.com/webhook
cronitor integration create -d '{"service":"webhook","name":"Hook","fields":{"key":"https://example.com"}}'
cronitor integration delete Alerts
cronitor integration delete Alerts --force
```

Integrations are addressed by their unique label; add `--service` when the same label exists for more than one service. Field names come from `cronitor integration services`. Most API-key services take a single `key` (the webhook URL or API key). Integrations can also be managed from [Settings → Integrations](https://cronitor.io/app/settings/integrations) or the [Integrations API](https://cronitor.io/docs/integrations-api.md).

## Crontab Guru Dashboard

CronitorCLI bundles the [Crontab Guru Dashboard](https://crontab.guru/dashboard.html), a self-hosted web UI to manage your cron jobs. It includes one-click "run now" and "suspend" actions, a local console for testing jobs, and a built-in [MCP server](#mcp-server-ai-integration) for configuring jobs and checking the health of existing ones.

**Start locally**

```bash
cronitor dash
# then visit http://localhost:9000
```

Use `--port` to change the port and `--safe-mode` to limit the ability to edit jobs, crontabs, and settings.

**Secure access**

The dashboard is intended for local or secured access. A simple, safe pattern for remote use is an SSH tunnel:

```bash
ssh -L 9000:localhost:9000 user@your-server
# now open http://localhost:9000
```

**Access control and options**

```bash
# Set login credentials via environment variables (preferred).
# --dash-username / --dash-password work but appear in shell history and process lists.
export CRONITOR_DASH_USER=USER
export CRONITOR_DASH_PASS=PASS
cronitor configure

# Optionally, restrict which system users' crontabs are loaded
cronitor configure --users user1,user2

# Optionally, restrict access to a list of IP addresses or CIDR ranges
cronitor configure --allowed-ips 192.168.1.0/24,10.0.0.1
```

For systemd and Docker examples, and security best practices, see the full [Dashboard documentation](https://crontab.guru/dashboard.html).

## MCP Server (AI integration)

CronitorCLI includes a built-in [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for managing cron jobs with natural language through AI-powered tools like Claude Code, Cursor, Cline, and Windsurf.

CronitorCLI's local MCP server can inspect and edit crontabs on the machine where the CLI runs. To manage Cronitor resources remotely, connect to the [Cronitor MCP server](https://cronitor.io/docs/mcp-server.md). The local and hosted servers can be used together.

The MCP server is a bridge that your AI tool spawns locally. It talks to the tool over stdio and connects to a running dashboard over HTTP, so `cronitor dash` must be running on the server where your cron jobs live.

**Quick start:** run `cronitor dash` on your server, then configure your MCP client to spawn `cronitor dash --mcp-instance default`.

```json
{
  "mcpServers": {
    "cronitor": {
      "command": "cronitor",
      "args": ["dash", "--mcp-instance", "default"]
    }
  }
}
```

The `default` instance connects to `localhost:9000` using the dashboard credentials from your Cronitor config file. Additional named instances for other hosts are configured in the same file. For setup instructions, available tools, and configuration options, see the [MCP Integration Guide](https://github.com/cronitorio/cronitor-cli/blob/master/docs/MCP_INTEGRATION.md).

## Safe use

### Wrap an executable without uploading its output

`cronitor exec` sends the wrapped command's stdout and stderr to Cronitor by default. It also includes the command string with run telemetry. Begin with output collection disabled:

```bash
cronitor exec --no-stdout monitor-key path/to/executable arg1 arg2
```

CLI flags such as `--no-stdout` must appear before the monitor key. Inspect the executable's arguments for passwords, tokens, connection strings, or customer data; move sensitive values to the workload's normal secret injector. Remove `--no-stdout` only after deciding that the output is appropriate to retain in Cronitor.

Put the wrapper in the real crontab, scheduler, service, or deployment command and preserve the executable's exit status. A test invocation from a setup shell does not prove that the production scheduler is monitored.

### Limit agent-visible output

Start account inspection with the CLI's default table or summary output. JSON/YAML exports and event expansions may contain request headers, bodies, event messages, or captured output. Request and locally filter those fields only when needed; do not paste raw exports into an agent conversation.

Keep verbose and file logging disabled during credential setup and telemetry debugging unless the destination and contents have been reviewed. Logs can include telemetry URLs or other sensitive request details.

Treat `sync`, `connect`, create, update, delete, and crontab-editing commands as writes. Inspect their help and proposed scope, reconcile stable monitor keys, and obtain approval before running them.

### On Your Server

If you're using Cronitor to monitor traditional cron jobs, `cronitor sync` is the easiest way to create monitors and keep their schedule in sync with your server. If you're monitoring Windows scheduled tasks, scripts, daemons, ETL processes or almost anything else, using CronitorCLI for `cronitor exec` and `cronitor ping` will send telemetry pings more reliably than simply using Curl.

- Required configuration can be provided as environment variables or from a json file. See Configuration section for details.
- Update easily to the latest version with a simple `cronitor update` command.
- Install CronitorCLI in a system-wide location to more easily monitor tasks running as different users.
- Run `cronitor dash` to manage the server's crontabs from a browser or an AI tool.

### On Your Local Machine

Running CronitorCLI on your local machine enables quick commandline access to your Cronitor account.

- Use `cronitor status` to view the status of every monitor from your terminal, or `cronitor status <key>` for a single monitor.
- Use the [account resource commands](#account-resource-commands) to inspect and change monitors, issues, status pages, and other resources.
- Like server deployment, update easily to the latest version with a simple `cronitor update` command.

## Configuration

Configuration variables like api key and current server hostname can be provided as runtime arguments or environment variables. Alternatively, the `configure` command can be used to save configuration variables to a file.

Prefer environment variables supplied by a secret manager over literal arguments. Set `CRONITOR_API_KEY` to the SDK Integration key. The CLI uses it for telemetry too unless `CRONITOR_PING_API_KEY` is set, so a separate telemetry key is optional.

| Name | Argument | Variable name |
|------|----------|---------------|
| Monitor API Key | `-k, --api-key [key]` | `CRONITOR_API_KEY` |
| Telemetry Events API Key | `-p, --ping-api-key [key]` | `CRONITOR_PING_API_KEY` |
| Current server name | `-n, --hostname [name]` | `CRONITOR_HOSTNAME` |
| Log Cronitor activity | `-l, --log [path]` | `CRONITOR_LOG` |
| Verbose output | `-v, --verbose` | |
| Users whose crontabs to include | `-u, --users [user1,user2]` | `CRONITOR_USERS` |
| Exclude from name | `-e, --exclude-from-name [substring]` (`configure` only) | `CRONITOR_EXCLUDE_TEXT` |
| Config file to use | `-c, --config [path to file]` | `CRONITOR_CONFIG` |
| Environment to send telemetry events to | `--env` | `CRONITOR_ENV` |
| Cronitor API version | `--api-version [date]` | `CRONITOR_API_VERSION` |
| Dashboard username | `--dash-username` (`configure` only) | `CRONITOR_DASH_USER` |
| Dashboard password | `--dash-password` (`configure` only) | `CRONITOR_DASH_PASS` |
| Dashboard allowed IPs | `--allowed-ips` (`configure` only) | `CRONITOR_ALLOWED_IPS` |
| Disable sending job output logs to Cronitor | `--no-stdout` (`exec` only) | |

### Default Config File Locations

| Platform | Default config file location |
|----------|------------------------------|
| Linux | `/etc/cronitor/cronitor.json` |
| MacOS | `/etc/cronitor/cronitor.json` |
| Windows | `%SystemDrive%\ProgramData\Cronitor\cronitor.json` |

### Configuration and secrets

Do not put API keys, ping keys, or dashboard passwords on the command line. Those flags (`--api-key`, `--ping-api-key`, `--dash-password`) remain for compatibility but appear in shell history and process lists. Set credentials in the environment instead:

```bash
export CRONITOR_API_KEY
cronitor configure
```

`cronitor configure` prints `API Key: Set` / `Ping API Key: Set` (or `Not Set`). It never prints complete keys. Dashboard passwords are shown as `********`.

New config files are created **owner-only** (`0600` on Unix; an owner-restricted ACL on Windows), and `configure` prints a note saying so the first time. An existing file keeps its current permissions when saved, so upgrading never changes which users can read it. `exec` and `ping` read the file exactly as before.

If an existing file is readable by other users, `configure` prints a note after saving. To make it owner-only:

```bash
cronitor configure --restrict
```

Jobs that run as another user then need credentials from somewhere else:

1. **Preferred:** set `CRONITOR_API_KEY` in the crontab or service environment. On Windows, set it on the scheduled task or Windows service.
2. **Per-user file:** a user-owned `0600` file via `--config` / `CRONITOR_CONFIG`.

If the config file exists but cannot be read, the CLI prints one warning to stderr naming the path instead of running unconfigured.

On Windows, new files get an owner-restricted ACL (Administrators and SYSTEM keep access, a platform limitation). Existing files keep their ACL unless `--restrict` is passed.

## Uninstall

First, run `cronitor sync --format=exec` for each crontab that sync changed. This removes the `SHELL=.../cronitor/shell` line (and `CRONITOR_SHELL=`, if any), restores your previous `SHELL`, and writes monitored jobs as `cronitor exec MONITOR_KEY ...`.

> **Warning:**
> Do not delete `/etc/cronitor/shell` while a crontab still has `SHELL=/etc/cronitor/shell`. If you do, no job in that crontab runs, including jobs without monitoring.

Then, update any crontab files that were edited to include Cronitor to remove the reference to `cronitor exec MONITOR_KEY` that were added when you created monitors.

Then, remove `/etc/cronitor/shell` or `~/.cronitor/shell`, and remove the cronitor executable from wherever it was installed. If you followed our default instructions it can be removed with `rm /usr/bin/cronitor`
