Re: Windows: Scheduled Ruby script won't run
- From: Mohit Sindhwani <mo_mail@xxxxxxxxx>
- Date: Wed, 7 Nov 2007 13:48:26 -0500
bdezonia@xxxxxxxx wrote:
Hello all,
I have looked on the web for an answer to my issue with little success
so I am trying here. I have a ruby script that I am scheduling at
computer startup on Windows. And apparently it never starts. If it
starts it should write a line to a file. From the command prompt the
script works fine but if logged in and attempting to start it from
Scheduled Tasks it fails too with no error messages or any evidence it
tried to start. I've checked account and password info for the task
and it is correct. In fact I've tried to different admin acounts
(though from a parent account). Is there something about the
environment maybe not being loaded since its not run from a shell that
is the problem? Any other ideas? Thanks for your insight.
The most common problem is the path. I usually bootstrap my Ruby script
using a .cmd file that sets the path to my Ruby interpreter and then
calls the interpreter with the name of the script. It's always worked
for me. Also, if for some reason, you don't trust the Windows
scheduler, you could use PyCron - it's a cron replacement on Windows
that works very well (specially recommended if you plan to schedule the
script more frequently than just system startup).
This is what I use in my scripts:
REM Set up the environment variables for the script
set PATH_TO_RUBY=d:\InstantRails\ruby\bin
set RUBY=%PATH_TO_RUBY%\ruby.exe
REM ** settings for accessing the remaining scripts **
set PATH_TO_SCRIPTS=X:\Projects\scripts
%RUBY% %PATH_TO_SCRIPTS%\my_script.rb
Hope this helps.
Cheers,
Mohit.
11/8/2007 | 2:47 AM.
.
- Follow-Ups:
- Re: Windows: Scheduled Ruby script won't run
- From: Mohit Sindhwani
- Re: Windows: Scheduled Ruby script won't run
- References:
- Windows: Scheduled Ruby script won't run
- From: bdezonia
- Windows: Scheduled Ruby script won't run
- Prev by Date: Rambling: try/catch
- Next by Date: Re: Language Popularity - PHP vs Ruby?
- Previous by thread: Windows: Scheduled Ruby script won't run
- Next by thread: Re: Windows: Scheduled Ruby script won't run
- Index(es):
Relevant Pages
|