@@ -139,12 +139,11 @@ run_backup.sh && curl -m 5 --retry 3 https://ping.checklyhq.com/f0e0b1d3-665d-49
139
139
### Kubernetes CronJob
140
140
Here is an example of how to add the curl command to a Kubernetes CronJob.
141
141
142
- ``` BASH
142
+ ``` YAML {title="my-scheduled-job.yaml"}
143
143
apiVersion : batch/v1
144
144
kind : CronJob
145
145
metadata :
146
146
name : nightly
147
- namespace: example
148
147
spec :
149
148
schedule : " 0 2 * * *"
150
149
jobTemplate :
@@ -170,7 +169,7 @@ This is an example with the built-in [https.get](https://nodejs.org/api/https.ht
170
169
{{< tabs "https.get" >}}
171
170
{{< tab "Typescript" >}}
172
171
` ` ` ts {title="my-scheduled-job.ts"}
173
- const https = require ( " https" ) ;
172
+ import https from "https";
174
173
175
174
// Sample URL
176
175
const url = "https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4";
@@ -186,7 +185,6 @@ https.get(url, options, (res) => {
186
185
console.log("responseBody:", data);
187
186
});
188
187
});
189
-
190
188
```
191
189
{{< /tab >}}
192
190
{{< tab "Javascript" >}}
@@ -207,7 +205,6 @@ https.get(url, options, (res) => {
207
205
console .log (" responseBody:" , data);
208
206
});
209
207
});
210
-
211
208
```
212
209
{{< /tab >}}
213
210
{{< /tabs >}}
@@ -219,19 +216,21 @@ You can also use [axios](https://axios-http.com/):
219
216
``` ts {title="my-scheduled-job.ts"}
220
217
import axios from ' axios'
221
218
222
- axios .get (' https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4' ).then (resp => {
223
- console .log (resp .data );
224
- })
219
+ axios .get (' https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4' )
220
+ .then (resp => {
221
+ console .log (resp .data );
222
+ })
225
223
226
224
```
227
225
{{< /tab >}}
228
226
{{< tab "JavaScript" >}}
229
227
``` js {title="my-scheduled-job.js"}
230
228
const axios = require (' axios' );
231
229
232
- axios .get (' https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4' ).then (resp => {
233
- console .log (resp .data );
234
- })
230
+ axios .get (' https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4' )
231
+ .then (resp => {
232
+ console .log (resp .data );
233
+ })
235
234
```
236
235
{{< /tab >}}
237
236
{{< /tabs >}}
0 commit comments