Skip to content

Overview and install

The host agent is one command, cronbeat, for cron jobs and systemd timers on Linux servers and VMs. You put it in front of your job: cronbeat run --name nightly-backup -- /opt/backup.sh. It starts the job, passes its exit code through unchanged, measures the run time and tells CronBeat that the run started and how it ended. CronBeat then alerts you when the job does not run, fails or runs too long. You do not add any ping call to your scripts.

The host agent is available on every plan (Free: 1 host, Pro: 10, Enterprise: 100), see Plans and limits. Every job you wrap is a monitor and also counts toward your monitor limit.

Most cron jobs run on plain Linux servers, not in Kubernetes. A failing script, a deleted crontab line or a powered-off VM produces no error you could alert on. With cronbeat run in front of the job, CronBeat learns about every start and every result, including the exit code, the signal that killed the job and, for a failed run, the last lines of its output.

Method Use it when Page
Host agent (cronbeat run) Your jobs run from crontab, /etc/cron.d, a systemd timer or a container on a Linux machine, and you want exit codes, failure output and a monitor created for you. This section
Ping URL (curl) You cannot install a program, the job runs somewhere other than Linux (CI, a PaaS, an application scheduler), or you want the smallest possible change. Ping endpoints, Code examples
Kubernetes agent The jobs are Kubernetes CronJobs and you want them discovered automatically. Kubernetes agent

The three methods can be mixed in one project. A host agent monitor and a ping monitor behave the same way once they exist: same statuses, same incidents, same channels.

  • No daemon and no background process. cronbeat run lives only as long as the job. Cron, a systemd timer or you start it, it starts your command, waits for it and exits with the exit code of your command. The binary is a single static file of about 6 MB, with no dependencies.
  • It reports twice per run. A started event when the job starts, a succeeded or failed event when it ends. The start event makes CronBeat show the monitor as running and lets it detect a job that never finishes.
  • It never harms your job. A missing key, a network outage or an error from CronBeat is a short warning on stderr, the job still runs and its exit code is unchanged.
  • The first run creates the monitor. The first event of a new job name creates a monitor with the schedule you passed. The schedule, time zone and name then belong to the command line: when you change them in your crontab, the monitor follows.
  • Linux on amd64 (x86_64) or arm64 (aarch64). macOS, Windows and 32-bit ARM are not supported.
  • Outbound HTTPS to api.cronbeat.dev from the machine that runs the job.
  • curl or wget, tar and sha256sum (or shasum) for the installer. Nothing else.
  • A host agent key. Create it in the app under Agents: choose Linux server (cron jobs), enter a server name (letters, digits, ., _ and -, up to 63 characters) and copy the key. It starts with cb_agent_ and is shown once.

1. Create the key. In the app open Agents, choose Linux server (cron jobs), name the server and press Create host agent. Copy the key.

2. Install the command on the server:

Terminal window
curl -fsSL https://docs.cronbeat.dev/install.sh | sh

3. Store the key. Run this as the user whose jobs you want to monitor (root for /etc/crontab and /etc/cron.d). It asks for the key with hidden input and saves it with mode 0600:

Terminal window
cronbeat configure

4. Wrap one job. In crontab -e, put cronbeat run in front of the command and tell it the schedule:

0 2 * * * /usr/local/bin/cronbeat run --name nightly-backup --schedule '0 2 * * *' -- /opt/backup.sh --full

Or wrap the whole crontab in one step. plan shows what would change and writes nothing, apply makes a backup, writes and verifies, undo restores the backup. See Crontab helper.

Terminal window
cronbeat crontab plan
cronbeat crontab apply

5. Check. Verify the key, then run a job by hand once so the monitor appears right away:

Terminal window
cronbeat check
cronbeat run --name nightly-backup --schedule "0 2 * * *" --verbose -- /opt/backup.sh --full

check prints OK: the API key is valid, the name of the host agent and where the key came from. In the app the Agents page shows Last run reported … and the Monitors list shows the job with the label Host agent.

install.sh is a short POSIX shell script, you can read it before running it (curl -fsSL https://docs.cronbeat.dev/install.sh | less).

  1. Detects Linux and the CPU (x86_64 or aarch64). Anything else stops with an error.
  2. Downloads cronbeat_<version>_linux_<arch>.tar.gz and SHA256SUMS from the GitHub release host-v<version> of the public cronbeat-agent repository, over HTTPS.
  3. Verifies the checksum. On any mismatch nothing is installed.
  4. Extracts only the cronbeat file, runs cronbeat version to confirm the version and installs it to /usr/local/bin. When that directory is not writable it uses ~/.local/bin and tells you to add it to your PATH. Cron has a short PATH, so use the absolute path in crontabs.

cronbeat: command not found after installing without root

Section titled “cronbeat: command not found after installing without root”

When the installer put the file in ~/.local/bin, that directory has to be on your PATH. For the current session:

Terminal window
export PATH="$HOME/.local/bin:$PATH"

To keep it for every new session, add the same line to your shell startup file and reload it:

Terminal window
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
. ~/.bashrc

Use ~/.zshrc instead of ~/.bashrc if your shell is zsh. This only changes your interactive shell. Cron does not read these files, so in a crontab always write the absolute path (for example /home/ubuntu/.local/bin/cronbeat), or let cronbeat crontab apply write it for you. To skip the PATH step altogether, install for all users: curl -fsSL https://docs.cronbeat.dev/install.sh | sudo sh puts it in /usr/local/bin.

Variable Meaning
CRONBEAT_VERSION Install another version than the default of the script.
CRONBEAT_INSTALL_DIR Install into this directory.
CRONBEAT_DOWNLOAD_BASE Download from a mirror of the release assets (HTTPS, or HTTP for localhost).

Release files also carry a build provenance attestation. To verify a downloaded archive by hand:

Terminal window
sha256sum -c SHA256SUMS --ignore-missing
gh attestation verify cronbeat_0.1.0_linux_amd64.tar.gz --repo nuricanozturk01/cronbeat-agent

To update, run the installer again. The Agents page shows Update available next to a host agent when a newer version is published and CronBeat knows about it. cronbeat version prints the installed version.

Situation Result
You run a new job name with --schedule the first time A monitor with that cron schedule is created, with a grace period of 5 minutes unless you pass --grace.
You change the schedule, time zone or name in your crontab The next run updates the monitor.
The job fails (exit code other than 0) The monitor goes down at once with exit code N or the signal, and the last 4 KB of the output is attached.
The job never starts (cron line deleted, server off) The monitor becomes late, then down with the reason missed after the grace period.
The job starts and never ends Reason too_long when a maximum runtime is set, otherwise missed (“started but never finished”).
CronBeat is unreachable during a run The job runs normally. The lost reports can make the monitor late or down, see Troubleshooting.
You delete the monitor in the app The next wrapped run creates it again, as a new monitor without the old history.
The plan allows fewer hosts or monitors See Plans and limits: the job keeps running, the warning on stderr names the limit.