Skip to content

Instantly share code, notes, and snippets.

@joemccann
Last active August 20, 2018 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joemccann/626fb65255804e5fc8e50e295aa1fdf2 to your computer and use it in GitHub Desktop.
Save joemccann/626fb65255804e5fc8e50e295aa1fdf2 to your computer and use it in GitHub Desktop.
const tiny = require('tiny-json-http')
const schedule = require('node-schedule')
const {
error,
log
} = console
function main() {
schedule.scheduleJob('* * * * *', async () => {
const urls = [
`https://XXX.now.sh/`,
`https://YYY.now.sh/`
]
for (let url of urls) {
try {
const ping = await tiny.get({
url
})
log(`Status: ${ping.body.status} | Timestamp: ${ping.body.timestamp}`)
} catch (e) {
error(e)
}
}
})
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment