-
-
Save theycallmeswift/2269756 to your computer and use it in GitHub Desktop.
Node ping cron
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"author": "", | |
"name": "1in7-cron-hour", | |
"description": "cron for 1in7", | |
"version": "0.0.0-2", | |
"repository": { | |
"url": "" | |
}, | |
"engines": { | |
"node": "~0.6.9" | |
}, | |
"dependencies": { | |
"request": "2.9.153", | |
"cron": "0.1.3" | |
}, | |
"devDependencies": {}, | |
"optionalDependencies": {}, | |
"subdomain": "1in7-cron-hour", | |
"scripts": { | |
"start": "server.js" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util') | |
, http = require('http') | |
, cronJob = require('cron').CronJob | |
, request = require('request'); | |
cronJob('0 0 * * * *', function(){ | |
return request({uri:'http://1in7.com/_cron_delivery.php'}, function (error, response, body) { | |
return util.log('Request succeeded'); | |
}); | |
}); | |
http.createServer(function(req, res) { | |
res.end("Hello world"); | |
}).listen(process.env.PORT || 3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment