diff --git a/static/css/docs.css b/static/css/docs.css new file mode 100644 index 00000000..42f16619 --- /dev/null +++ b/static/css/docs.css @@ -0,0 +1,4 @@ +.curl-opts th { + white-space: nowrap; + font-family: monospace; +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 3c832476..d96e1ea5 100644 --- a/templates/base.html +++ b/templates/base.html @@ -16,6 +16,7 @@ + diff --git a/templates/front/docs.html b/templates/front/docs.html index 6d13c7d2..8fa84643 100644 --- a/templates/front/docs.html +++ b/templates/front/docs.html @@ -8,7 +8,7 @@
-Each check you create in My Checks +Each check in My Checks page has an unique "ping" URL. Whenever you access this URL, the "Last Ping" value of corresponding check is updated.
@@ -25,8 +25,7 @@ It is all very simple, really.The response will have status code "200 OK" and response body will be a @@ -39,10 +38,10 @@ short and simple string "OK".
-When using cron, probably the easiest is to append a curl
-or wget
call after your command. The scheduled time comes,
-and your command runs. After it completes, the healthchecks.io check
-gets pinged.
+When using cron, probably the easiest is to append a curl
+or wget call after your command. The scheduled time comes,
+and your command runs. If it completes successfully (exit code 0),
+curl or wget runs a HTTP GET call to the ping URL.
Either way, when your task doesn't finish successfully, you will soon know about it.
+The extra options to curl are meant to suppress any output, unless it hits +an error. This is to prevent cron from sending an email every time the +task runs. Feel free to adjust the curl options to your liking. +
+&& | +Run curl only if /home/user/backup.sh succeeds |
+
---|---|
+ -f, --fail + | +Makes curl treat non-200 responses as errors | +
-s, --silent | +Silent or quiet mode. Don't show progress meter or error messages. | +
-S, --show-error | +When used with -s it makes curl show error message if it fails. | +
--retry <num> | ++ If a transient error is returned when curl tries to perform a + transfer, it will retry this number of times before giving up. + Setting the number to 0 makes curl do no retries + (which is the default). Transient error means either: a timeout, + an FTP 4xx response code or an HTTP 5xx response code. + | +
> /dev/null | ++ Redirect curl's stdout to /dev/null (error messages go to stderr,) + | +
# using curl:
-curl {{ ping_url }}
+curl --retry 3 {{ ping_url }}
# using wget:
wget {{ ping_url }} -O /dev/null
diff --git a/templates/front/snippets/bash.txt b/templates/front/snippets/bash.txt
index 30d8a114..cdca954f 100644
--- a/templates/front/snippets/bash.txt
+++ b/templates/front/snippets/bash.txt
@@ -1,5 +1,5 @@
# using curl:
-curl PING_URL
+curl --retry 3 PING_URL
# using wget:
wget PING_URL -O /dev/null
\ No newline at end of file
diff --git a/templates/front/snippets/crontab.html b/templates/front/snippets/crontab.html
index 67581548..07afc5d4 100644
--- a/templates/front/snippets/crontab.html
+++ b/templates/front/snippets/crontab.html
@@ -1,3 +1,3 @@
# m h dom mon dow command
- 8 6 * * * /home/user/tasks/backup_all.sh && curl {{ ping_url }}
+ 8 6 * * * /home/user/backup.sh && curl -fsS --retry 3 {{ ping_url }} > /dev/null
diff --git a/templates/front/snippets/crontab.txt b/templates/front/snippets/crontab.txt
index c7e8aad3..1ff49e6f 100644
--- a/templates/front/snippets/crontab.txt
+++ b/templates/front/snippets/crontab.txt
@@ -1,2 +1,2 @@
# m h dom mon dow command
- 8 6 * * * /home/user/tasks/backup_all.sh && curl PING_URL
\ No newline at end of file
+ 8 6 * * * /home/user/backup.sh && curl -fsS --retry 3 PING_URL > /dev/null
\ No newline at end of file