Browse files

Automatically add > /dev/null 2>&1 to all commands unless running wit…

…h --debug flag. Run everloop with unicorn.
  • Loading branch information...
1 parent 6b01478 commit 4fd2a1c5b195ad6d077baa0c5455a5c2b7acd6e7 @maxim maxim committed Mar 22, 2011
Showing with 37 additions and 22 deletions.
  1. +10 −10 support/takeup/everloop/manifest.yml
  2. +3 −0 support/takeup/everloop/unicorn.conf
  3. +10 −10 support/takeup/printio/manifest.yml
  4. +14 −2 takeup
View
20 support/takeup/everloop/manifest.yml
@@ -1,23 +1,23 @@
- name: "redis"
pid_file: ":project_root/tmp/pids/redis.pid"
- start: "redis-server :support_root/redis.conf > /dev/null 2>&1"
- stop: "kill `cat :pid_file` > /dev/null 2>&1"
+ start: "redis-server :support_root/redis.conf"
+ stop: "kill `cat :pid_file`"
- start: "sleep 5"
stop: "sleep 5"
- name: "resque"
pid_file: ":project_root/tmp/pids/resque.pid"
- start: "/bin/sh -c 'PIDFILE=:pid_file QUEUE=* VERBOSE=1 nohup rake environment resque:work& > :project_root/log/resque.log' > /dev/null 2>&1"
- stop: "kill `cat :pid_file` && rm :pid_file > /dev/null 2>&1"
+ start: "/bin/sh -c 'PIDFILE=:pid_file QUEUE=* VERBOSE=1 nohup rake environment resque:work& > :project_root/log/resque.log'"
+ stop: "kill `cat :pid_file` && rm :pid_file"
- name: "juggernaut"
pid_file: ":project_root/tmp/juggernaut.pid"
- start: "juggernaut -c :project_root/config/juggernaut.yml -d --pid :pid_file --log :project_root/log/juggernaut.log > /dev/null 2>&1"
- stop: "juggernaut -c :project_root/config/juggernaut.yml -k * --pid :pid_file --log :project_root/log/juggernaut.log > /dev/null 2>&1"
+ start: "juggernaut -c :project_root/config/juggernaut.yml -d --pid :pid_file --log :project_root/log/juggernaut.log"
+ stop: "juggernaut -c :project_root/config/juggernaut.yml -k * --pid :pid_file --log :project_root/log/juggernaut.log"
-- name: "mongrel"
- pid_file: ":project_root/tmp/pids/mongrel.pid"
- start: "mongrel_rails start --daemonize -P :pid_file -l :project_root/log/mongrel.log > /dev/null 2>&1"
- stop: "mongrel_rails stop -P :pid_file > /dev/null 2>&1 && rm -f :pid_file > /dev/null 2>&1"
+- name: "unicorn"
+ pid_file: ":project_root/tmp/pids/unicorn.pid"
+ start: "unicorn_rails -D -c :support_root/unicorn.conf"
+ stop: "kill -QUIT `cat :pid_file`"
required: true
View
3 support/takeup/everloop/unicorn.conf
@@ -0,0 +1,3 @@
+pid "/Users/max/dev/everloop/tmp/pids/unicorn.pid"
+stderr_path "/Users/max/dev/everloop/log/unicorn.log"
+stdout_path "/Users/max/dev/everloop/log/unicorn.log"
View
20 support/takeup/printio/manifest.yml
@@ -1,28 +1,28 @@
- name: "jaxer"
pid_file: "/Users/max/dev/printio/printio/tmp/pids/jaxer.pid"
- start: ":support_root/jaxer_start > /dev/null 2>&1"
- stop: ":support_root/jaxer_stop > /dev/null 2>&1"
+ start: ":support_root/jaxer_start"
+ stop: ":support_root/jaxer_stop"
- name: "postgres"
pid_file: "/usr/local/var/postgres/postmaster.pid"
- start: "pg_ctl -D /usr/local/var/postgres -l :project_root/log/postgres.log start > /dev/null 2>&1"
- stop: "pg_ctl -D /usr/local/var/postgres stop -s -m fast > /dev/null 2>&1"
+ start: "pg_ctl -D /usr/local/var/postgres -l :project_root/log/postgres.log start"
+ stop: "pg_ctl -D /usr/local/var/postgres stop -s -m fast"
required: true
- start: "sleep 2"
- name: "unicorn"
pid_file: ":project_root/tmp/pids/unicorn.pid"
- start: "unicorn_rails -D -c :support_root/unicorn.conf > /dev/null 2>&1"
- stop: "kill -QUIT `cat :pid_file` > /dev/null 2>&1"
+ start: "unicorn_rails -D -c :support_root/unicorn.conf"
+ stop: "kill -QUIT `cat :pid_file`"
required: true
- name: "sphinx"
pid_file: ":project_root/tmp/pids/sphinx.pid"
- start: "rake ts:start > /dev/null 2>&1"
- stop: "rake ts:stop > /dev/null 2>&1"
+ start: "rake ts:start"
+ stop: "rake ts:stop"
- name: "delayed_job"
pid_file: ":project_root/tmp/pids/delayed_job.pid"
- start: ":support_root/delayed_job start > /dev/null 2>&1"
- stop: ":support_root/delayed_job stop > /dev/null 2>&1"
+ start: ":support_root/delayed_job start"
+ stop: ":support_root/delayed_job stop"
View
16 takeup
@@ -63,14 +63,26 @@ end
project_title = use_color ? "\e[32m#{project_name.capitalize}\e[0m" : project_name.capitalize
skipped = use_color ? "\e[31m - skipped\e[0m" : ' - skipped'
projects_for_regex = processes.map{|p| p['name'] && Regexp.escape(p['name'])}.compact.join('|')
+debug_mode = !!ARGV.delete('--debug')
+
+run_command = lambda do |command|
+ cmd = command.dup
+
+ if debug_mode
+ puts `#{cmd}`
+ else
+ cmd << ' > /dev/null 2>&1'
+ system cmd
+ end
+end
start_process = lambda do |process|
if process['start'] && (process['pid_file'].nil? || !running?(process))
if process['name']
puts "-> Starting #{process['name']}"
end
- system process['start']
+ run_command.call(process['start'])
elsif process['pid_file'] && running?(process)
puts skipped
end
@@ -82,7 +94,7 @@ stop_process = lambda do |process|
puts "-> Stopping #{process['name']}"
end
- system process['stop']
+ run_command.call(process['stop'])
elsif process['pid_file'] && !running?(process)
puts "-> Stopping #{process['name']}"
puts skipped

0 comments on commit 4fd2a1c

Please sign in to comment.