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
# The ability to disable/enable access to phpMyAdmin on a Rails project that has | |
# an installation in the public directory. | |
namespace :phpmyadmin do | |
desc "Disable access to phpMyAdmin" | |
task :disable, :roles => :web do | |
run "echo 'deny from all' > #{current_path}/public/phpmyadmin/.htaccess" | |
end | |
desc "Enable access to phpMyAdmin" | |
task :enable, :roles => :web do |
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
In the context of this cronjob: | |
/usr/bin/lockrun --lockfile=/path/to/lockrun.collections.batch.execute -- sh -c "NEWRELIC_ENABLE=true $RAKE_SILENT collections:batch:execute --trace" | |
Does this look right (whole thing outputs to /dev/null, but rake task directs to mail command): | |
/usr/bin/lockrun --lockfile=/path/to/lockrun.collections.batch.execute -- sh -c "NEWRELIC_ENABLE=true $RAKE_SILENT collections:batch:execute --trace 2>&1 | mail -s "Output from collections_batch_execute" someone@somewhere.com" >> /dev/null 2>&1 |
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
desc "Reindex all sunspot models in solr" | |
task :reindex_sunspot , :roles => :app, :only => {:solr => true} do | |
run "cd #{release_path} && rake #{rails_env} sunspot:reindex" | |
end |
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
cd /var/log/engineyard/mongrel/ecr | |
f=production.log | |
mv $f $f.tmp && touch $f && chown ecr:ecr $f && monit restart all -g ecr && gzip -c $f.tmp > /data/old_logs/`hostname`/mongrel/ecr/$f-`date +%Y%m%d-%H:%M`.gz && rm $f.tmp | |
cd /var/log/engineyard/nginx | |
f=ecr.access.log | |
mv $f $f.tmp && touch $f && kill -HUP `cat /var/run/nginx.pid` && gzip -c $f.tmp > /data/old_logs/`hostname`/nginx/$f-`date +%Y%m%d-%H:%M`.gz && rm $f.tmp |
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
# Replace "appname" as appropriate for your environment | |
remote_file "/data/nginx/servers/appname.rewrites" do | |
owner node[:owner_name] | |
group node[:owner_name] | |
mode 0644 | |
source "appname.rewrites" | |
backup false | |
action :create | |
end |
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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "mechanize" | |
def growl(title, message) | |
ENV['title'] = title | |
ENV['message'] = message | |
%x(/usr/local/bin/growlnotify "\$title" -m"\$message") | |
end |
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
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
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
bundle exec ./script/console | |
Loading development environment (Rails 2.3.10) | |
>> class TestQueue | |
>> @queue = :test | |
>> def self.perform(thing) | |
>> logger.debug("Performing thing: #{thing}") | |
>> end | |
>> end | |
=> nil | |
>> Resque.enqueue(TestQueue, "this thing") |
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
#!/bin/bash | |
if [ -f ./script/rails ]; then | |
echo "Looks like Rails 3.x..." | |
COMMAND='./script/rails runner' | |
elif [ -f ./script/runner ]; then | |
echo "Looks like Rails 2.x..." | |
COMMAND='./script/runner' | |
fi |
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
service "vixie-cron" | |
service "sysklogd" | |
service "nginx" | |
link "/etc/localtime" do | |
to "/usr/share/zoneinfo/GB" | |
notifies :restart, resources(:service => ["vixie-cron", "sysklogd", "nginx"]), :delayed | |
not_if "readlink /etc/localtime | grep -q 'GB$'" | |
end |
OlderNewer