-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails Error: Unable to access log file #3
Comments
Yeah this was bugging me to. I suspect it has something to do with the fact that ever since Ruby 1.9, the ruby interpreter doesn't seem to set pwd properly (for me, anyway). So for example, if I want to run tests, I have to do something like this: Enjoy. :) |
I had same error on ruby 1.9.2p180 & rails 3.0.9.
So, if
conflicts and exception occures. this is backtrace:
I solved this problems with renaming
Hope this helps. |
Any updates for this issue? |
Another solution may be inserting directly jobs into DJ database table and thus not need to load whole Rails env. Example for postgres: # clock.rb
require 'pg'
require 'yaml'
db = YAML.load_file(File.dirname(__FILE__) + "/database.yml")[ENV['RAILS_ENV'] || "development"]
conn = PGconn.connect(db['host'], nil, nil, nil, db['database'], db['username'], db['password'])
require 'clockwork'
include Clockwork
handler do |job|
db_time = Time.now.utc.strftime("%Y-%m-%d %H:%M:%S")
handler = "--- !ruby/object:ScheduledJob \njob: #{job}\n"
conn.exec("INSERT INTO \"delayed_jobs\" (\"failed_at\", \"locked_by\", \"created_at\", \"handler\", \"updated_at\", \"priority\", \"run_at\", \"attempts\", \"locked_at\", \"last_error\") VALUES(NULL, NULL, '#{db_time}', '#{handler}', '#{db_time}', 0, '#{db_time}', 0, NULL, NULL)")
end
every(30.minutes, 'reactivate_paid_accounts') |
If anybody else is having issues with this, I have a simpler solution for you: # lib/tasks/clock.rake
task "clock" => :environment do
STDERR.sync = STDOUT.sync = true
require 'clockwork' #notice: not including, just requiring
Clockwork.every 5.seconds, 'do-some-task' do
puts "TEST - 5 seconds have passed"
end
Clockwork.run
end Now instead of adding |
I have a Rails 3 application which uses delayed_job as job queue. When I use clockwork with the following configuration, I get an error that the rails process can't access the log file.
I already checked the permissions of the log file.
Versions used:
Rails 3.0.5
Ruby 1.9.2-p136
delayed_job 2.1.4
clockwork 0.2.3
The text was updated successfully, but these errors were encountered: