# Capistrano - 'sanity\_check' task

**URL:** <https://www.ruby-forum.com/t/capistrano-sanity-check-task/110484>\
**Category:** Rails\
**Created:** [July 26, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/capistrano-sanity-check-task/110484 "2007-07-26T19:25:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blinking\_bear](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a9a28c/32.png) [@blinking\_bear](https://www.ruby-forum.com/u/blinking_bear)\
**Post date:** [July 26, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/capistrano-sanity-check-task/110484/1 "2007-07-26T19:25:05Z")

</div>

I instantly refresh my browser after deploying to make sure nothing went  
wrong. This gets tiring so I added some code to hit the site and print  
results after the deployment task has been run. The Net:HTTP code is  
taken  
verbatim from the pickaxe Net:HTTP reference.

task :after\_deploy, :roles =\> :app do  
sanity\_check  
end

desc “Use Net:HTTP to pull up the live site”  
task :sanity\_check do  
Net::HTTP.start(‘[www.yoursite.com](http://www.yoursite.com)’) do |http|  
response = http.get(‘/’)  
puts “Code = #{response.code}”  
puts “Message = #{response.message}”  
response.each do |key,val|  
printf “%-14s = %-40.40s\n”, key, val  
end  
p response.body[400,500]  
end  
end
