Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run a Rake task as a Windows "scheduled task"?

I have a rake task I need to run as a daily job on a Windows XP machine. I discovered the Windows "scheduled tasks" control panel. I'm trying to figure out how to get it to run my Rake task.

Two of the fields are "run" (with a browse button) and "start in". I tried to enter rake mycategory:mytask into "run" and my Rails project dir containing the Rake task into "start in". The result was a message saying the task "could not start".

How can I get set up a Windows "scheduled task" to run a Rake task?

like image 759
Ethan Avatar asked Mar 01 '23 14:03

Ethan


1 Answers

If you can build a batch file that can execute it properly I would do so, and then you can direct the batch file to run with the task.

Something like this should work:

:: Run task every hour
@call rake stats RAILS_ENV="production"
like image 65
mwilliams Avatar answered Mar 09 '23 01:03

mwilliams