Move user content note-data commits from a cron job into app.
This commit is contained in:
parent
891918e050
commit
4825ebb10f
24
server.js
24
server.js
@ -184,6 +184,30 @@ io.on('connection', function(socket){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setInterval(
|
||||||
|
function() {
|
||||||
|
//winston.info('setInterval fired.');
|
||||||
|
var exec = require('child_process').exec;
|
||||||
|
const userIdArray = db.users.userIdArray();
|
||||||
|
for (const userId of userIdArray) {
|
||||||
|
var noteDir;
|
||||||
|
if (userId === 1) {
|
||||||
|
noteDir = __dirname + '/note-data/';
|
||||||
|
} else {
|
||||||
|
noteDir = __dirname + '/note-data/' + userId + '/';
|
||||||
|
}
|
||||||
|
//winston.info('noteDir = ' + noteDir);
|
||||||
|
exec(
|
||||||
|
`cd ${noteDir} && git push`,
|
||||||
|
{ uid: 1000 },
|
||||||
|
function(err) {
|
||||||
|
if (err) { winston.error(err); }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, 120000 // 2 min
|
||||||
|
);
|
||||||
|
|
||||||
http.listen(3000, function() {
|
http.listen(3000, function() {
|
||||||
winston.info("Started on PORT 3000");
|
winston.info("Started on PORT 3000");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user