This repository has been archived on 2023-11-14. You can view files and clone it, but cannot push or open issues/pull-requests.
valnet/relay/service.js

36 lines
638 B
JavaScript
Raw Normal View History

2020-11-11 19:38:39 -05:00
(() => {
2020-11-11 21:02:58 -05:00
const log = require('signale');
2020-11-11 19:38:39 -05:00
const { execSync } = require('child_process');
const branch = 'master';
2020-11-11 21:02:58 -05:00
function update() {
const remoteHash = execSync('git ls-remote https://github.com/marcus13345/valnet.git').toString().split(/[\t\n]/g)[0].trim();
const localHash = execSync(`git rev-parse ${branch}`).toString().trim();
if(remoteHash !== localHash) {
log.info('remote hash:', remoteHash);
log.info('local hash: ', localHash);
2020-11-11 21:42:23 -05:00
execSync(`git fetch`, { stdio: "inherit" });
execSync(`git pull`, { stdio: "inherit" });
2020-11-11 21:02:58 -05:00
process.exit(2);
}
}
2020-11-11 19:38:39 -05:00
2020-11-11 21:42:23 -05:00
// require('./index.js');
2020-11-11 19:38:39 -05:00
2020-11-11 21:02:58 -05:00
setInterval(update, 5000);
2020-11-11 19:38:39 -05:00
})();