Skip to content

Commit

Permalink
Merge pull request #1033 from naritta/fix-no-supervisor
Browse files Browse the repository at this point in the history
Add --run-worker to distinguish it from running without supervisor
  • Loading branch information
tagomoris authored Jun 20, 2016
2 parents 287877f + ee5999b commit 05762dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/fluent/command/fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,15 @@
opts[:daemonize] = s
}

op.on('--no-supervisor', "run without fluent supervisor") {
op.on('--under-supervisor', "run fluent worker under supervisor (this option is NOT for users)") {
opts[:supervise] = false
}

op.on('--no-supervisor', "run fluent worker without supervisor") {
opts[:supervise] = false
opts[:standalone_worker] = true
}

op.on('--user USER', "change user") {|s|
opts[:chuser] = s
}
Expand Down
11 changes: 10 additions & 1 deletion lib/fluent/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def self.default_options
without_source: false,
use_v1_config: true,
supervise: true,
standalone_worker: false,
signame: nil,
winsvcreg: nil,
}
Expand All @@ -319,6 +320,7 @@ def self.default_options
def initialize(opt)
@daemonize = opt[:daemonize]
@supervise = opt[:supervise]
@standalone_worker= opt[:standalone_worker]
@config_path = opt[:config_path]
@inline_config = opt[:inline_config]
@use_v1_config = opt[:use_v1_config]
Expand Down Expand Up @@ -381,6 +383,7 @@ def run_worker
$log.info "starting fluentd-#{Fluent::VERSION} without supervision"

main_process do
create_socket_manager if @standalone_worker
change_privilege
init_engine
run_configure
Expand All @@ -391,6 +394,12 @@ def run_worker

private

def create_socket_manager
socket_manager_path = ServerEngine::SocketManager::Server.generate_path
ServerEngine::SocketManager::Server.open(socket_manager_path)
ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = socket_manager_path.to_s
end

def dry_run
$log.info "starting fluentd-#{Fluent::VERSION} as dry run mode"
change_privilege
Expand Down Expand Up @@ -444,7 +453,7 @@ def supervise
}
end

fluentd_spawn_cmd << ("--no-supervisor")
fluentd_spawn_cmd << ("--under-supervisor")
$log.info "spawn command to main: " + fluentd_spawn_cmd

params = {}
Expand Down

0 comments on commit 05762dd

Please sign in to comment.