Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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