#!/usr/bin/env ruby check = `ps ax | grep ruby`.split("\n").select{ |line| line.index($0) } check.select! { |line| !line.index("#{Process.pid} ") } if check.length > 0 puts "Lux job_que allready running" puts check exit end eval File.read './lux/loader.rb' Lux.delay.run! # require 'pathname' # pid_file = Pathname.new("./tmp/job_que.pid") # if pid_file.exist? # pid = pid_file.read # proc = `ps -p #{pid} -o comm=` # if proc.to_s.length > 1 # puts "Lux job_que allready running, pid: #{pid}" # system "ps ax | grep #{pid} | grep ruby" # exit # end # end # pid_file.write(Process.pid) # Kernel.at_exit { pid_file.delete } # Lux.config.redis_server = Redis::Queue.new('__test', 'bp__test', :redis => Redis.new) # Lux.delay.server = :memory # Lux.delay.server = :redis # Lux.delay.push("puts '123 abc > mem'.red") # Lux.delay.push("puts '123 abc > redis'.red") # Lux.delay.push(Mailer.confirm_email('rejotl@gmail.com'), :deliver) # Mailer.confirm_email('rejotl@gmail.com').deliver_later # Lux.delay.run!