mirror of
https://ghfast.top/https://github.com/discourse/docker_manager.git
synced 2026-07-15 11:36:28 +08:00
``` root@07d212411142-app:/var/www/discourse# pgrep -f "pitchfork monitor" 30864 root@07d212411142-app:/var/www/discourse# rails c Loading production environment (Rails 8.0.4) discourse(prod)> `pgrep -af "pitchfork monitor"` => "11035 sh -c pgrep -af \"pitchfork monitor\"\n30864 pitchfork monitor - \n" discourse(prod)> `pgrep -f "pitchfork monitor"`.strip.to_i => 12545 ``` The current regex is getting the pid of the pgrep shell command, rather than the actual pitchfork monitor. Using ^ anchor avoids this problem.
17 lines
304 B
Ruby
17 lines
304 B
Ruby
# frozen_string_literal: true
|
|
|
|
module DockerManager
|
|
class PitchforkAdapter < WebServerAdapter
|
|
def server_name
|
|
"Pitchfork"
|
|
end
|
|
|
|
def launcher_pid
|
|
`pgrep -f unicorn_launcher`.strip.to_i
|
|
end
|
|
|
|
def master_pid
|
|
`pgrep -f "^pitchfork monitor"`.strip.to_i
|
|
end
|
|
end
|
|
end
|