Navigation Menu

Skip to content

Commit

Permalink
Add --daemon option
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 25, 2014
1 parent 180690d commit 0b86929
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/droonga-http-server
Expand Up @@ -2,6 +2,7 @@
// -*- js -*-

var fs = require('fs'),
daemon = require('daemon'),
express = require('express'),
bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
Expand Down Expand Up @@ -53,8 +54,13 @@ options
droonga.API_DROONGA
])
.option('--pid-file <pid-file>', 'Output PID to <pid-file>.')
.option('--daemon', 'Run as a daemon.')
.parse(process.argv);

if (options.daemon) {
daemon();
}

if (options.pidFile) {
var fd = fs.openSync(options.pidFile, 'w', 0644);
fs.writeSync(fd, process.pid.toString());
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -21,6 +21,7 @@
"dependencies": {
"cookie-parser": "*",
"commander": "*",
"daemon": "*",
"express": ">=4.0",
"express-droonga": "*",
"express-session": "*",
Expand Down

0 comments on commit 0b86929

Please sign in to comment.