var fs = require('fs');

var cronJob = require('cron').CronJob;

var config = require('./config');
var data = require('./data');


function init() {
    writeJSON();
}
module.exports = init;

function writeJSON() {
    write();

    new cronJob('*/5 * * * *', write, null, true);

    function write() {
        data.checks(config.pingdom, 5, function(err, data) {
            fs.writeFile('./public/data.json', JSON.stringify(data), function(err) {
                if(err) return console.error(err);

                console.log('Wrote data.json');
            });
        });
    }
}

@@ -334,16 +334,17 @@
 ngdom, 5
+0
 , functi

Increase the amount of data points