mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
updated loader to kickstart the web installer if no config is found
This commit is contained in:
55
loader.js
55
loader.js
@@ -246,31 +246,38 @@ nconf.argv().env().file({
|
|||||||
file: path.join(__dirname, '/config.json')
|
file: path.join(__dirname, '/config.json')
|
||||||
});
|
});
|
||||||
|
|
||||||
if (nconf.get('daemon') !== false) {
|
fs.open(path.join(__dirname, 'config.json'), 'r', function(err) {
|
||||||
if (fs.existsSync(pidFilePath)) {
|
if (!err) {
|
||||||
try {
|
if (nconf.get('daemon') !== false) {
|
||||||
var pid = fs.readFileSync(pidFilePath, { encoding: 'utf-8' });
|
if (fs.existsSync(pidFilePath)) {
|
||||||
process.kill(pid, 0);
|
try {
|
||||||
process.exit();
|
var pid = fs.readFileSync(pidFilePath, { encoding: 'utf-8' });
|
||||||
} catch (e) {
|
process.kill(pid, 0);
|
||||||
fs.unlinkSync(pidFilePath);
|
process.exit();
|
||||||
|
} catch (e) {
|
||||||
|
fs.unlinkSync(pidFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require('daemon')({
|
||||||
|
stdout: process.stdout,
|
||||||
|
stderr: process.stderr
|
||||||
|
});
|
||||||
|
|
||||||
|
fs.writeFile(__dirname + '/pidfile', process.pid);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
require('daemon')({
|
async.series([
|
||||||
stdout: process.stdout,
|
Loader.init,
|
||||||
stderr: process.stderr
|
Loader.displayStartupMessages,
|
||||||
});
|
Loader.start
|
||||||
|
], function(err) {
|
||||||
fs.writeFile(__dirname + '/pidfile', process.pid);
|
if (err) {
|
||||||
}
|
console.log('[loader] Error during startup: ' + err.message);
|
||||||
|
}
|
||||||
async.series([
|
});
|
||||||
Loader.init,
|
} else {
|
||||||
Loader.displayStartupMessages,
|
// No config detected, kickstart web installer
|
||||||
Loader.start
|
var child = require('child_process').fork('app');
|
||||||
], function(err) {
|
|
||||||
if (err) {
|
|
||||||
console.log('[loader] Error during startup: ' + err.message);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -10,8 +10,7 @@
|
|||||||
},
|
},
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "./nodebb start",
|
"start": "node loader.js",
|
||||||
"stop": "./nodebb stop",
|
|
||||||
"test": "mocha ./tests -t 10000"
|
"test": "mocha ./tests -t 10000"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user