forked from wesleyhales/loadreport
-
Notifications
You must be signed in to change notification settings - Fork 1
/
schedule-loadreport.js
39 lines (34 loc) · 1.39 KB
/
schedule-loadreport.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var exec = require('child_process').exec;
var increment = 0;
function runLoadreport(){
exec('phantomjs loadreport.js http://www.people.com performance csv', function (error, stdout, stderr) {
exec('mv reports/loadreport.csv reports/loadreport-' + increment + '.csv', function(error, stdout, stderr){
console.log('CSV ' + increment + ' done.');
});
});
exec('phantomjs loadreport.js http://www.people.com performancecache json', function (error, stdout, stderr) {
exec('mv reports/loadreport.json reports/loadreport-' + increment + '.json', function(error, stdout, stderr){
console.log('JSON ' + increment + ' done.');
});
});
exec('phantomjs loadreport.js http://www.people.com filmstrip', function (error, stdout, stderr) {
exec('mkdir filmstrip/filmstrip-' + increment, function(error, stdout, stderr){
exec('mv filmstrip/screenshot*.png filmstrip/filmstrip-' + increment + '/', function(error, stdout, stderr){
console.log('Filmstrip ' + increment + ' done.')
});
});
});
makeTimeout();
increment++;
}
function makeTimeout(){
var d = new Date();
var min = d.getMinutes();
var sec = d.getSeconds();
if((min == '00') && (sec == '00')) {
runLoadreport();
} else {
setTimeout(runLoadreport, (60*(60-min)+(60-sec))*1000);
}
}
makeTimeout();