shovel/Shovel/main.js
2015-11-20 16:27:20 -05:00

19 lines
477 B
JavaScript

var cp = require('child_process');
var fs = require('fs');
var server = cp.fork('index.js');
console.log('Server started');
fs.watchFile('config.json', function (event, filename) {
server.kill();
console.log('Server stopped');
server = cp.fork('index.js');
console.log('Server started');
});
process.on('SIGINT', function () {
server.kill();
fs.unwatchFile('config.json');
console.info('found an error in the server');
process.exit();
});