Using CronitorCLI


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 discover and sync schedule changes to Cronitor automatically.

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

Power tools for your cron jobs
Use list and select to view and run any cron job on your system. Use shell to test running a command like cron does.

Install by Script (recommended)

CronitorCLI is packaged as a single executable for Linux, MacOS and Windows. This simple installation script will select the right binary for your operatng system and platform, install it, and if you are logged-in right now it will automatically configure your API key. View Source

You can re-run this script at any time to install the latest version of CronitorCLI.

Current Version: 30.4

curl https://cronitor.io/install-linux?sudo=1 -H "API-KEY: <API-KEY>"  | sh

After installation, run "cronitor discover" to find and monitor your cron jobs.

Manual Installation

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

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.

curl -sOL https://cronitor.io/dl/linux_amd64.tar.gz
sudo tar xvf linux_amd64.tar.gz -C /usr/bin/
sudo cronitor configure --api-key <API-KEY>

Testing your installation
To verify your installation, run cronitor from your terminal.  A usage block will be printed to your screen. After installation, run "cronitor discover" to find and monitor your cron jobs.

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.

curl -sOL https://cronitor.io/dl/darwin_amd64.tar.gz
sudo tar xvf darwin_amd64.tar.gz -C /usr/local/
sudo cronitor configure --api-key <API-KEY>

Testing your installation
To verify your installation, run cronitor from your terminal.  A usage block will be printed to your screen. After installation, run "cronitor discover" to find and monitor your cron jobs.

  1. Download application: https://cronitor.io/dl/windows_amd64.zip
  2. Unzip and move the executable to %ProgramFiles%\ for system-wide use
  3. Run %ProgramFiles%\cronitor.exe configure --api-key <API-KEY> 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.

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/tag/30.4

Verify a build

MD5 and SHA256 hashes for every build are available on our Github Release page:
https://github.com/cronitorio/cronitor-cli/releases/tag/30.4

Installing from source

View on Github

After installation, run "cronitor discover" to find and monitor your cron jobs.

Usage

$ cronitor
CronitorCLI version 26.3

Command line tools for Cronitor.io. See https://cronitor.io/docs/using-cronitor-cli for details.

Usage:
  cronitor [command]

Available Commands:
  activity    View monitor activity
  configure   Save configuration variables to the config file
  discover    Attach monitoring to new cron jobs and watch for schedule updates
  exec        Execute a command with monitoring
  help        Help about any command
  list        Search for and list all cron jobs
  ping        Send a single ping to the selected monitoring endpoint
  select      Select a cron job to run interactively
  shell       Run commands from a cron-like shell
  status      View monitor status
  update      Update to the latest version

Flags:
  -k, --api-key string        Cronitor API Key
  -c, --config string         Config file
  -h, --help                  Help for cronitor
  -n, --hostname string       A unique identifier for this host (default: system hostname)
  -l, --log string            Write debug logs to supplied file
  -p, --ping-api-key string   Telemetry Events API Key
  -v, --verbose               Verbose output

Use "cronitor [command] --help" for more information about a command.

Running CronitorCLI on your server

If you're using Cronitor to monitor traditional cron jobs, cronitor discover 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 later in this document 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.

Running CronitorCLI on your local machine

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

  • Use cronitor status to view your current Cronitor dashboard details from your terminal
  • View and query monitor activity using cronitor activity. Use the optional --before [timestamp] param to paginate results.
  • Like server deployment, update easily to the latest version with a simple cronitor updatecommand.

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.

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 --log [path] CRONITOR_LOG
Exclude from name -e, --exclude-from-name [substring] CRONITOR_EXCLUDE_TEXT
Config file to use -c, --config [path to file] CRONITOR_CONFIG
Environment to send telemetry events to --env CRONITOR_ENV
Disable sending job output logs to Cronitor --no-stdout

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

Uninstall CronitorCLI

First, you will need to 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 the cronitor executable from wherever it was installed. If you followed our default instructions it can be removed with rm /usr/bin/cronitor