File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,13 @@ variable.
235
235
236
236
$ VVERBOSE=1 QUEUE=file_serve rake environment resque:work
237
237
238
+ ### Process IDs (PIDs)
239
+
240
+ There are scenarios where it's helpful to record the PID of a resque
241
+ worker process. Use the PIDFILE option for easy access to the PID:
242
+
243
+ $ PIDFILE=./resque.pid QUEUE=file_serve rake environment resque:work
244
+
238
245
239
246
### Priorities and Queue Lists
240
247
Original file line number Diff line number Diff line change 8
8
task :work => :setup do
9
9
require 'resque'
10
10
11
- worker = nil
12
11
queues = ( ENV [ 'QUEUES' ] || ENV [ 'QUEUE' ] ) . to_s . split ( ',' )
13
12
14
13
begin
19
18
abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work"
20
19
end
21
20
21
+ if ENV [ 'PIDFILE' ]
22
+ File . open ( ENV [ 'PIDFILE' ] , 'w' ) { |f | f << Process . pid . to_s }
23
+ end
24
+
22
25
worker . log "Starting worker #{ worker } "
23
26
24
27
worker . work ( ENV [ 'INTERVAL' ] || 5 ) # interval, will block
You can’t perform that action at this time.
0 commit comments