Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to employ the method descibed here.

My crontab:

# m h  dom mon dow   command
@reboot /home/qe2user/.rvm/environments/ruby-1.9.3-p125 /home/qe2user/Ruby/test/prog.rb > /home/qe2user/Ruby/test/crondebug.log 2>&1

My ruby prog:

doit = true
while doit
    File.open('/home/qe2user/Ruby/test/test.txt','a') {|f| f.write(Time.now.to_s + "\n")}
    doit = false
end

the output in crondebug.log:

/bin/sh: /home/qe2user/.rvm/environments/ruby-1.9.3-p125: Permission denied

I issued "chmod u+x prog.rb", then rebooted again, but got the same results.

prog.rb, such as it is, does write to the file when I just run it from the command line.

Any help would be greatly appreciated.

share|improve this question
    
Is /home/qe2user/.rvm/environments/ruby-1.9.3-p125 executable? ls -la /home/qe2user/.rvm/environments/ruby-1.9.3-p125 – Paul Apr 19 '12 at 2:19
up vote 0 down vote accepted

The file you are executing is /home/qe2user/.rvm/environments/ruby-1.9.3-p125, not /home/qe2user/Ruby/test/prog.rb.

Therefore, you have to make the first one executable:

chmod u+x /home/qe2user/.rvm/environments/ruby-1.9.3-p125

This is, of course, assuming that ruby-1.9.3-p125 is owned by the crontab's user.

share|improve this answer
    
Well, that did away with the "Permission denied". Thank you. Now my problem is, the file, "test.txt" is not getting written. Sigh. – davej Apr 19 '12 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .