Skip to content

Instantly share code, notes, and snippets.

View donnoman's full-sized avatar

Donovan Bray donnoman

View GitHub Profile
#!/usr/bin/env ruby
# based on http://gist.github.com/29838
# logging to syslog added
# added killing orphaned procs
# added culling applications to maintain some per application limits
# Find bloating passengers and kill them gracefully. Run from cron every so often.
#
require "rubygems"
require "logging"
#migration to allow nulls for Authlogic Account Activation Tutorial
#http://www.claytonlz.com/index.php/2009/07/authlogic-account-activation-tutorial/
class AllowNullCryptedPassword < ActiveRecord::Migration
def self.up
change_column :users, :crypted_password, :string, :null => true
change_column :users, :password_salt, :string, :null => true
end
def self.down
# Helper to execute blocks of shell commands via capistrano run
def run_chunk(cmd,options={})
run cmd.split("\n").map {|l| l.strip }.join(" "), options
end
# Example
task :revision, :roles => [:app] do
run_chunk %Q{
cd #{current_release};
cp REVISION public/REVISION;
#!/bin/bash
# How to exit if any command in a bash subshell fails with piping all output
set -o pipefail
(
set -o errexit;
echo -n "T";
# false;
echo -n "e";
# false;
echo -n "s";