@@ -5,16 +5,28 @@ namespace :sidekiq do
5
5
end
6
6
7
7
desc "GITLAB | Start sidekiq"
8
- task :start do
9
- system "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{ Rails . env } -P #{ pidfile } >> #{ Rails . root . join ( "log" , "sidekiq.log" ) } 2>&1 &"
8
+ task :start => :restart
9
+
10
+ desc 'GitLab | Restart sidekiq'
11
+ task :restart do
12
+ if File . exist? ( pidfile )
13
+ puts 'Shutting down existing sidekiq process.'
14
+ Rake ::Task [ 'sidekiq:stop' ] . invoke
15
+ puts 'Starting new sidekiq process.'
16
+ end
17
+ system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{ Rails . env } -P #{ pidfile } -d -L #{ log_file } >> #{ log_file } 2>&1"
10
18
end
11
19
12
20
desc "GITLAB | Start sidekiq with launchd on Mac OS X"
13
21
task :launchd do
14
- system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{ Rails . env } -P #{ pidfile } >> #{ Rails . root . join ( "log" , "sidekiq.log" ) } 2>&1"
22
+ system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{ Rails . env } -P #{ pidfile } >> #{ log_file } 2>&1"
15
23
end
16
24
17
25
def pidfile
18
26
Rails . root . join ( "tmp" , "pids" , "sidekiq.pid" )
19
27
end
28
+
29
+ def log_file
30
+ Rails . root . join ( "log" , "sidekiq.log" )
31
+ end
20
32
end
0 commit comments