6

I'm trying to run the following command on my remote server (either via capistrano or ssh):

bundle exec RAILS_ENV=production script/delayed_job start

But I'm getting this error message: bundler: not executable: script/delayed_job

Never saw this before, and google had nothing for me. Any idea what might be the problem?

1
  • Thanks @stanislav, apparently the problem is that deploying with capistrano from windows doesnt set any files as executable. I'm not sure if it's capistrano or windowws or both, but setting permissions solved the problem
    – hananamar
    Nov 18, 2014 at 7:04

2 Answers 2

13

Maybe it does not have permissions to run? Try running this command

chmod +x script/delayed_job

and then executing the file again.

1
  • 1
    I have to run this everytime. Is there a way to make this permission to run permanent set to my capistrano deploy user? Sep 16, 2019 at 21:55
2

I am not sure if if it is a fundamental misunderstanding of the capistrano rbenv gem or some issue with the gem itself, but I had similar issue with delayed_job, where the bin/delayed_job file just would not get the executable permission when copied to the server by capistrano. So I wrote a task which I had run before invoking the delayed_job:restart task.

Note - Adding this answer because earlier one is from 2014, and also I wanted to show how to add the task, so the permission change can happen during deployment itself.

Created a task in lib/capistrano/tasks folder (in namespace delayed_job):

namespace :delayed_job do
  desc 'Ensure that bin/delayed_job has the permission to be executable. Ideally, this should not have been needed.'
    task :ensure_delayed_job_executable do
      on roles(delayed_job_roles) do
        within release_path do
          execute :chmod, :'u+x', :'bin/delayed_job'
        end
    end
  end
end

after 'deploy:publishing', 'deploy:restart'
namespace :deploy do
  task :restart do
    invoke 'delayed_job:ensure_delayed_job_executable'
    invoke 'delayed_job:restart'
  end
end
1
  • It is nice to find answers that have no votes yet, and it works. Worth to notice the after rails 4 we have bin/delayed job as you described in this post - as a difference to previous post that was refering to rails 3.x using script/delay_job May 7, 2021 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.