Looks ok. I don’t think you need execute permission either, just read
permission would do, because you’re passing the file to the interpreter.
Verify that:
* Interpreter path is correct
* Program does not have errors and you are able to run it yourself
* It has correct permissions for accessing files etc as the user
you’ve setup the cron for
* If you’re just printing stuff remember it doesn’t have $stdout or
$stderr to write to, redirect those to some log file
I am quite noob
however…
if your script does use gui, maybe you must use
DISPLAY=:0.0
*/5 * * * * /usr/local/bin/ruby /local/myuser/rubyscript/script1.rb
a useful link may be
CC Chen wrote in post #1039530:
Hi all,
I used crontab command such as
“*/5 * * * * /usr/local/bin/ruby /local/myuser/rubyscript/script1.rb”
But it can’t execute script1.rb, I let it print some message every 5
min.
Run ‘env -i $SHELL --norc’. It will bring up a new naked shell that is
equivalent to what cron runs. Run your command as-is in this shell to
ensure it works correctly.
Looks ok. I don’t think you need execute permission either, just read
permission would do, because you’re passing the file to the interpreter.
Verify that:
* Interpreter path is correct
* Program does not have errors and you are able to run it yourself
* It has correct permissions for accessing files etc as the user
you’ve setup the cron for
* If you’re just printing stuff remember it doesn’t have $stdout or
$stderr to write to, redirect those to some log file
Run ‘env -i $SHELL --norc’. It will bring up a new naked shell that is
equivalent to what cron runs. Run your command as-is in this shell to
ensure it works correctly.
So I add this command ‘env -i $SHELL --norc’ on crontab directly?
Run ‘env -i $SHELL --norc’. It will bring up a new naked shell that is
equivalent to what cron runs. Run your command as-is in this shell to
ensure it works correctly.
So I add this command ‘env -i $SHELL --norc’ on crontab directly?
No. This was intended for testing only.
Btw, you do not have those quotes at the beginning and end of the line
in your crontab, do you? If yes, you must remove them.
Kind regards
robert
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.