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.
235235
236236 $ VVERBOSE=1 QUEUE=file_serve rake environment resque:work
237237
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+
238245
239246### Priorities and Queue Lists
240247
Original file line number Diff line number Diff line change 88 task :work => :setup do
99 require 'resque'
1010
11- worker = nil
1211 queues = ( ENV [ 'QUEUES' ] || ENV [ 'QUEUE' ] ) . to_s . split ( ',' )
1312
1413 begin
1918 abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work"
2019 end
2120
21+ if ENV [ 'PIDFILE' ]
22+ File . open ( ENV [ 'PIDFILE' ] , 'w' ) { |f | f << Process . pid . to_s }
23+ end
24+
2225 worker . log "Starting worker #{ worker } "
2326
2427 worker . work ( ENV [ 'INTERVAL' ] || 5 ) # interval, will block
You can’t perform that action at this time.
0 commit comments