Skip to content

Commit

Permalink
Add PID file to Kibana Server
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Jan 28, 2015
1 parent 6ac17b0 commit 8c486f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/server/bin/kibana.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var program = require('commander');
var env = (process.env.NODE_ENV) ? process.env.NODE_ENV : 'development';
var path = require('path');
var packagePath = path.resolve(__dirname, '..', '..', '..', 'package.json');
var fs = require('fs');
if (env !== 'development') {
packagePath = path.resolve(__dirname, '..', 'package.json');
}
Expand Down Expand Up @@ -56,4 +57,14 @@ if (program.host) {
// Load and start the server. This must happen after all the config changes
// have been made since the server also requires the config.
var server = require('../');
server.start();
var logger = require('../lib/logger');
server.start(function (err) {
if (!err && config.kibana.pid_file) {
fs.writeFile(config.kibana.pid_file, process.pid, function (err) {
if (err) {
logger.fatal('Failed to write PID file to %s', config.kibana.pid_file);
process.exit(1);
}
});
}
});
2 changes: 2 additions & 0 deletions src/server/config/kibana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ shard_timeout: 0
# certificate.
verify_ssl: true

# Set the path to where you would like the process id file to be created.
# pid_file: /var/run/kibana.pid

0 comments on commit 8c486f8

Please sign in to comment.