Skip to content
cronitorex.com

Shell Script Client

The bundled cronitorex.sh client wraps the API calls so you don’t write curl by hand.

Installation

Terminal window
# Copy to system path
sudo cp client/cronitorex.sh /usr/local/bin/cronitorex
sudo chmod +x /usr/local/bin/cronitorex

Configure via .cronitorex-config.json in your home directory:

{
"api_url": "http://api.cronitorex.com",
"api_key": "your-cronitorex-api-key"
}

Usage

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

Statuses

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

Options

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

Example

Terminal window
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

Using in Docker

Mount the script and config into your container:

volumes:
- ./client/cronitorex.sh:/usr/local/bin/cronitorex:ro
- ./client/.cronitorex-config.json:/root/.cronitorex-config.json:ro