This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Unicorn ### | |
check process unicorn | |
with pidfile "/home/deploy/qna/shared/tmp/pids/unicorn.pid" | |
start program = "/bin/su - deploy -c 'cd /home/deploy/qna/current && RAILS_ENV=production /home/deploy/.rbenv/bin/rbenv exec bundle exec unicorn -c /home/deploy/qna/current/config/unicorn/production.rb -E deployment -D'" | |
stop program = "/bin/su - deploy -c 'kill -s QUIT `cat /home/deploy/qna/current/tmp/pids/unicorn.pid`'" | |
if memory usage > 90% for 3 cycles then restart | |
if cpu usage > 90% for 2 cycles then restart | |
if 5 restarts within 5 cycles then timeout | |
### Nginx ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'csv' | |
require 'ostruct' | |
def print_movies(movies) | |
movies.each { |movie| puts "#{movie[:title]} (#{movie[:date]}; #{movie[:genres].join("/")}) - #{movie[:duration]} min" } | |
end | |
def parse_date(date) |