email via sidekiq. start and stop rake tasks

This commit is contained in:
Dmitriy Zaporozhets 2013-01-09 08:44:05 +03:00
parent c7bb3a1f72
commit 71bd956866
15 changed files with 36 additions and 46 deletions

23
lib/tasks/sidekiq.rake Normal file
View file

@ -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