Skip to content

Instantly share code, notes, and snippets.

@serg-kovalev
Created August 1, 2014 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serg-kovalev/a201e89e69ee5a86ad79 to your computer and use it in GitHub Desktop.
Save serg-kovalev/a201e89e69ee5a86ad79 to your computer and use it in GitHub Desktop.
Monitor your Phusion passenger instances. This script allows you to automatically gracefully reload passenger instances (if they ate too much memory). See the required library: https://gist.github.com/serg-kovalev/71af1ccd121fba7ef56e
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'passenger_monitor'))
# Set logger to log into Rails project /log directory and start monitoring
PassengerMonitor.run(
:log_file => File.join(File.dirname(__FILE__), '..', 'log', 'passenger_monitor.log'),
:memory_limit => 400, # this is in MB
:wait_time => 10, # this in seconds (timeout before attempts)
:attempts => 5 # number of attempts
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment