mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-16 21:40:23 +01:00
Compare commits
16 Commits
custom-use
...
v0.4.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2832265677 | ||
|
|
5df0ebf895 | ||
|
|
0bc8b20f70 | ||
|
|
727ac0d534 | ||
|
|
7f54cb2452 | ||
|
|
b858193753 | ||
|
|
b1b2a03747 | ||
|
|
45c62da51c | ||
|
|
f88d7e6170 | ||
|
|
13b4aa2282 | ||
|
|
995fb22600 | ||
|
|
5de430deb5 | ||
|
|
e1c9bd7229 | ||
|
|
eabbc81b40 | ||
|
|
e29aa5abf8 | ||
|
|
cde7168f9c |
33
loader.js
33
loader.js
@@ -3,16 +3,10 @@
|
|||||||
var nconf = require('nconf'),
|
var nconf = require('nconf'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
pidFilePath = __dirname + '/pidfile',
|
pidFilePath = __dirname + '/pidfile',
|
||||||
|
output = fs.openSync(__dirname + '/logs/output.log', 'a'),
|
||||||
start = function() {
|
start = function() {
|
||||||
var fork = require('child_process').fork,
|
var fork = require('child_process').fork,
|
||||||
// output = fs.openSync(__dirname + '/logs/output.log', 'a'),
|
|
||||||
output = fs.createWriteStream(__dirname + '/logs/output.log', {
|
|
||||||
flags: 'a',
|
|
||||||
encoding: 'utf-8'
|
|
||||||
}),
|
|
||||||
nbb_start = function() {
|
nbb_start = function() {
|
||||||
var silent = nconf.get('daemon') !== false;
|
|
||||||
|
|
||||||
if (timesStarted > 3) {
|
if (timesStarted > 3) {
|
||||||
console.log('\n[loader] Experienced three start attempts in 10 seconds, most likely an error on startup. Halting.');
|
console.log('\n[loader] Experienced three start attempts in 10 seconds, most likely an error on startup. Halting.');
|
||||||
return nbb_stop();
|
return nbb_stop();
|
||||||
@@ -27,29 +21,13 @@ var nconf = require('nconf'),
|
|||||||
nbb = fork('./app', process.argv.slice(2), {
|
nbb = fork('./app', process.argv.slice(2), {
|
||||||
env: {
|
env: {
|
||||||
'NODE_ENV': process.env.NODE_ENV
|
'NODE_ENV': process.env.NODE_ENV
|
||||||
},
|
}
|
||||||
silent: silent
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (silent) {
|
|
||||||
nbb.stdout.pipe(output);
|
|
||||||
nbb.stderr.pipe(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
nbb.on('message', function(message) {
|
nbb.on('message', function(message) {
|
||||||
if (message && typeof message === 'object' && message.action) {
|
if (message && typeof message === 'object' && message.action) {
|
||||||
if (message.action === 'restart') {
|
if (message.action === 'restart') {
|
||||||
nbb_restart();
|
nbb_restart();
|
||||||
} else if (message.action === 'ready' && silent) {
|
|
||||||
// Output bind_address
|
|
||||||
process.stdout.write('\nNodeBB listening on ' + message.bind_address + '\n\n');
|
|
||||||
|
|
||||||
// Daemonize and record new pid
|
|
||||||
require('daemon')({
|
|
||||||
stdout: output
|
|
||||||
});
|
|
||||||
fs.writeFile(__dirname + '/pidfile', process.pid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -105,13 +83,18 @@ if (nconf.get('daemon') !== false) {
|
|||||||
try {
|
try {
|
||||||
var pid = fs.readFileSync(pidFilePath, { encoding: 'utf-8' });
|
var pid = fs.readFileSync(pidFilePath, { encoding: 'utf-8' });
|
||||||
process.kill(pid, 0);
|
process.kill(pid, 0);
|
||||||
console.log('\n Error: Another NodeBB is already running!');
|
|
||||||
process.exit();
|
process.exit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
fs.unlinkSync(pidFilePath);
|
fs.unlinkSync(pidFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Daemonize and record new pid
|
||||||
|
require('daemon')({
|
||||||
|
stdout: output
|
||||||
|
});
|
||||||
|
fs.writeFile(__dirname + '/pidfile', process.pid);
|
||||||
|
|
||||||
start();
|
start();
|
||||||
} else {
|
} else {
|
||||||
start();
|
start();
|
||||||
|
|||||||
1190
npm-shrinkwrap.json
generated
Normal file
1190
npm-shrinkwrap.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user