Once you’ve added your first Cron Job uptime monitor (as described here: https://docs.hetrixtools.com/add-a-cron-job-monitor-heartbeat-monitor/), you will be given a unique URL which you’ll need to use in order to let our platform know that your monitored target is still ‘up’ and healthy.

The URL will look something like this: https://sm.hetrixtools.net/hb/?s=uniquestring

In this guide, we’ll go through a few ways that you can automatically access this unique URL.

Adding the URL directly to your Crontab in Unix and Linux

This is the simplest way of using this type of uptime monitor, hence its name.

You’ll need to create a cronjob that would ping/access the URL periodically (in our example below, it will be every minute). The cronjob line should look like this:

* * * * * curl -I "https://sm.hetrixtools.net/hb/?s=uniquestring" >/dev/null 2>&1

Or if you’d like to use wget instead of curl the cronjob would look something like this:

* * * * * wget --spider "https://sm.hetrixtools.net/hb/?s=uniquestring" >/dev/null 2>&1

Adding the URL to one of your scripts

By accessing the URL at the end of one of your scripts, you’d make sure that said script has run its course successfully.

You can easily do this in a number of different languages, but we’ll take bash here as an example. Below we’ll have a simple bash script that would call the URL after completing its course of backing up some files:

#!/bin/bash
# Example bash script
tar -czvf /backup/user1.tar.gz /home/user1
curl -I "https://sm.hetrixtools.net/hb/?s=uniquestring" >/dev/null 2>&1

You can also substitute curl with wget just like shown in the Crontab examples.

This way, whenever your (in this example) backup script runs successfully, it will also ping/access the unique URL. In the event that your backup script fails to run for some reason, the URL will not be pinged/accessed, and your Cron Job uptime monitor will be marked as ‘DOWN’ and notifications will be dispatched, so you’ll be alerted of the issue.