I have a number of custom scripts that run at the console. Now I want cron
to take over and run them on a daily basis. If I /usr/bin/run-parts /etc/cron.daily
at the console all jobs run fine. However, if I leave it to cron and check next day
there was no indication the scripts had run at all. No change in output to log.
I wonder if ruby is not able to run under the cron shell (is it that different than sh?).
Has anyone had to deal with this or can offer a suggestion?
and they run just fine. This is on Arch Linux. If you can run them
through the cron command manually, I don't see why it wouldn't work from
crond. Could it be some sort of permissions issue?
and they run just fine. This is on Arch Linux. If you can run them
through the cron command manually, I don't see why it wouldn't work from
crond. Could it be some sort of permissions issue?
Jason,
Well crond runs as root so I don't think permission is the problem. The difference
seems to be in how I run the script.
ruby /path/script/my_script
Now that you mention it I vaguely recall reference to runner usage. Let see
if I have this right.
I should
ruby script/generate task my_script
then
ruby /path/script/runner 'MyScript'
to run it.
Jason Norris wrote:
>
> I have several rails scripts that run
>
> ruby /dir/to/app/script/runner 'Actions'
>
> and they run just fine. This is on Arch Linux. If you can run them
> through the cron command manually, I don't see why it wouldn't work from
> crond. Could it be some sort of permissions issue?
>
Jason,
Well crond runs as root so I don't think permission is the problem. The difference
seems to be in how I run the script.
ruby /path/script/my_script
Now that you mention it I vaguely recall reference to runner usage. Let see
if I have this right.
I should
ruby script/generate task my_script
hmm... there is no 'task' script. See ruby script/generate --help. Also found this link
I think I will create a utility class and put all my scripts there. It will
help clean up my code for sure. Then I can use script/runner
to start the process. In this way all scripts will run under one rails
env instead of a separate one for each.