mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 10:56:11 +02:00
Fix to create pidfile on Mac
This commit is contained in:
parent
703eba0079
commit
c7233a565e
@ -4,11 +4,11 @@ class Fluentd
|
||||
module Macosx
|
||||
|
||||
def start
|
||||
detached_command("launchctl load #{plist}")
|
||||
detached_command("launchctl load #{plist}") && pid_from_launchctl
|
||||
end
|
||||
|
||||
def stop
|
||||
detached_command("launchctl unload #{plist}")
|
||||
detached_command("launchctl unload #{plist}") && FileUtils.rm(pid_file)
|
||||
end
|
||||
|
||||
def restart
|
||||
@ -20,6 +20,13 @@ class Fluentd
|
||||
def plist
|
||||
'/Library/LaunchDaemons/td-agent.plist'
|
||||
end
|
||||
|
||||
def pid_from_launchctl
|
||||
# NOTE: launchctl doesn't make pidfile, so detect pid and store it to pidfile manually
|
||||
pid = `launchctl list | grep td-agent | cut -f1`.strip
|
||||
return if pid == ""
|
||||
File.open(pid_file, "w"){|f| f.write pid }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user