Skip to content

Repository files navigation

Cronitorex CLI

Lightweight shell client for Cronitorex: cron job and HTTP/SSL endpoint monitoring via simple pings. Wraps the ping API so you don't write curl by hand.

Full docs: docs.cronitorex.com/guides/shell-script

Installation

Download the latest client and put it on your PATH:

curl -fsSL https://cronitorex.com/cronitorex.sh -o /usr/local/bin/cronitorex
chmod +x /usr/local/bin/cronitorex

Optional: verify the download against the published checksum.

curl -fsSL https://cronitorex.com/cronitorex.sh.sha256
sha256sum /usr/local/bin/cronitorex

Or clone this repo and run cronitorex.sh directly.

Configure via .cronitorex.conf in your home directory:

api_url=https://api.cronitorex.com
api_key=your-cronitorex-api-key

The legacy JSON config format (see .cronitorex-config.json.example) is still read for backward compatibility.

Version and updates

The download URL always serves the latest client. Updates are on demand, not automatic.

cronitorex version          # installed version and date
cronitorex update --check   # check whether a newer version exists
cronitorex update           # download, verify checksum, replace (keeps a .bak)

update pulls from the same URL, verifies the SHA-256 checksum, runs a syntax check, backs up the current file as .bak, then swaps it in. It needs curl, sha256sum and bash, and only updates over HTTPS.

Version history: see CHANGELOG.md, or the canonical client changelog.

Usage

cronitorex ping <monitor-name> <status> [options]

Statuses

cronitorex ping my-job run
cronitorex ping my-job complete
cronitorex ping my-job fail
cronitorex ping my-job skip

Options

Flag Description
--duration <seconds> Job duration
--exit-code <int> Process exit code
--host <hostname> Override hostname
--message <text> Log message

Example

cronitorex ping db-backup run

pg_dump mydb > /tmp/backup.sql
EXIT=$?

cronitorex ping db-backup $([ $EXIT -eq 0 ] && echo complete || echo fail) \
  --exit-code $EXIT \
  --duration $SECONDS

Checking your setup

Run doctor to verify that everything is configured correctly:

cronitorex doctor          # checks config, API URL, key, connectivity
cronitorex doctor --ping   # additionally sends a real test ping (state: skip)

It checks: HTTP tool availability (curl/wget), config file and its permissions, API URL and key, temp directory, API reachability (/health) and crontab access. Exit code is 0 when everything is OK, 1 when problems are found.

Using in Docker

Mount the script and config into your container:

volumes:
  - ./cronitorex.sh:/usr/local/bin/cronitorex:ro
  - ./.cronitorex.conf:/root/.cronitorex.conf:ro

Testing

bash test_cronitorex.sh

Sign up

Cronitorex is free to use: cronitorex.com

License

MIT, see LICENSE.

About

Lightweight shell client for Cronitorex: cron job and HTTP/SSL endpoint monitoring via simple pings

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages