Permalink
Browse files

set_rails_env waits for god to restart before exiting.

  • Loading branch information...
1 parent 51da1e8 commit 2c18ba676e65ab562aa710567aa70fdbb7cd245b @pauldowman committed Oct 22, 2009
Showing with 7 additions and 2 deletions.
  1. +7 −2 server/files/usr/local/ec2onrails/bin/set_rails_env
@@ -23,7 +23,6 @@
require "yaml"
require "erb"
-require "#{File.dirname(__FILE__)}/../lib/utils"
if ARGV.length != 1
@@ -40,4 +39,10 @@ end
# Tell god to quit, which will cause it to be restarted immediately by init.
# When it restarts it keeps it's monitoring state. This causes it to reload
# it's idea of RAILS_ENV because it's used in notifications.
-Utils.run "god quit"
+system("god quit > /dev/null")
+
+# Wait for it to restart
+command = "god status > /dev/null"
+while !system(command)
+ sleep 1
+end

0 comments on commit 2c18ba6

Please sign in to comment.