diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-09 09:44:05 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-09 09:44:05 +0400 |
commit | 71bd9568669d18bc04c551a603a04af2ea99328c (patch) | |
tree | 1ae9e5d5564239a48dd6da6c0c577192e43251c9 /lib | |
parent | c7bb3a1f726be189ccce51bdd631b26eb4f64db1 (diff) |
email via sidekiq. start and stop rake tasks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/resque.rake | 23 | ||||
-rw-r--r-- | lib/tasks/sidekiq.rake | 23 |
2 files changed, 23 insertions, 23 deletions
diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake deleted file mode 100644 index e469aef3f94..00000000000 --- a/lib/tasks/resque.rake +++ /dev/null @@ -1,23 +0,0 @@ -require 'resque/tasks' - -namespace :resque do - task setup: :environment do - #Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection } - end - - desc "Resque | kill all workers (using -QUIT), god will take care of them" - task :stop_workers => :environment do - #pids = Array.new - - #Resque.workers.each do |worker| - #pids << worker.to_s.split(/:/).second - #end - - #if pids.size > 0 - #system("kill -QUIT #{pids.join(' ')}") - #end - end -end - -desc "Alias for resque:work (To run workers on Heroku)" -task "jobs:work" => "resque:work" diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake new file mode 100644 index 00000000000..6bbcb3da4bc --- /dev/null +++ b/lib/tasks/sidekiq.rake @@ -0,0 +1,23 @@ +namespace :sidekiq do + desc "GITLAB | Stop sidekiq" + task :stop do + run "bundle exec sidekiqctl stop #{pidfile}" + end + + desc "GITLAB | Start sidekiq" + task :start do + run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,common,default -e #{rails_env} -P #{pidfile} >> #{root_path}/log/sidekiq.log 2>&1 &" + end + + def root_path + @root_path ||= File.join(File.expand_path(File.dirname(__FILE__)), "../..") + end + + def pidfile + "#{root_path}/tmp/pids/sidekiq.pid" + end + + def rails_env + ENV['RAILS_ENV'] || "production" + end +end |