Skip to content

Instantly share code, notes, and snippets.

@theycallmeswift
Forked from vbonacci/package.json
Created March 31, 2012 23:42
Show Gist options
  • Save theycallmeswift/2269756 to your computer and use it in GitHub Desktop.
Save theycallmeswift/2269756 to your computer and use it in GitHub Desktop.
Node ping cron
{
"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"
}
}
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