Permalink
Browse files

Added start and stop scripts

  • Loading branch information...
1 parent 7ff43e8 commit 66e28ac393f52a1bddc7c4e165da8750df422b8a @airhorns committed Nov 20, 2011
Showing with 34 additions and 1 deletion.
  1. +2 −0 .gitignore
  2. +4 −0 Gemfile
  3. +2 −0 Gemfile.lock
  4. +3 −0 config.ru
  5. +10 −0 go_baby_go.sh
  6. +6 −0 notification_daemon.rb
  7. +1 −1 notification_server.rb
  8. +6 −0 stop.sh
View
2 .gitignore
@@ -0,0 +1,2 @@
+goliath*
+log/*
View
4 Gemfile
@@ -14,6 +14,10 @@ group :sms do
gem "em-twilio", :git => "git://github.com/groupme/em-twilio.git"
end
+group :daemon do
+ gem 'daemons'
+end
+
group :http do
gem 'eventmachine'
gem "em-http-request"
View
2 Gemfile.lock
@@ -25,6 +25,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.1.3)
+ daemons (1.1.4)
em-http-request (1.0.0)
addressable (>= 2.2.3)
em-socksify
@@ -88,6 +89,7 @@ PLATFORMS
DEPENDENCIES
coffee-script
coffee-script-source (= 1.1.3)
+ daemons
em-http-request
em-synchrony!
em-twilio!
View
3 config.ru
@@ -0,0 +1,3 @@
+require File.expand_path './user_server', File.dirname(__FILE__)
+Sinatra::Application.set :environment, :production
+run Sinatra::Application
View
10 go_baby_go.sh
@@ -0,0 +1,10 @@
+ruby exchange_server.rb --daemonize --port=9000 --environment=production
+pid=`cat goliath.pid`
+echo "Exchange PID: $pid"
+ruby notification_daemon.rb start
+pid=`ruby notification_daemon.rb status | cut -d[ -f2 | cut -d" " -f 2 | cut -d] -f1`
+echo "Notification server PID: $pid"
+thin start --daemonize
+pid=`cat tmp/pids/thin.pid`
+echo "User server PID: $pid"
+
View
6 notification_daemon.rb
@@ -0,0 +1,6 @@
+require "rubygems"
+require "bundler/setup"
+
+Bundler.require :daemon
+
+Daemons.run('notification_server.rb')
View
2 notification_server.rb
@@ -3,7 +3,7 @@
require 'net/http'
require 'uri'
-$: << "." << './lib'
+$: << File.dirname(__FILE__) << File.expand_path('./lib', File.dirname(__FILE__))
Bundler.require :http, :sms
require "em-synchrony/fiber_iterator"
View
6 stop.sh
@@ -0,0 +1,6 @@
+thin stop
+kill `cat goliath.pid`
+ruby notification_daemon.rb stop
+rm *.pid
+mkdir -p log
+mv *.log log/

0 comments on commit 66e28ac

Please sign in to comment.