docker_manager/lib/docker_manager/pitchfork_adapter.rb
dobon 275295bc01
FIX: Update pitchfork master_pid regex to avoid self-reference shell pid (#306)
```
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.
2026-03-10 17:19:22 +01:00

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