views:

477

answers:

4

Hi,

I just setup cron on my windows dev system in order to perform an hourly run of a script.

I tried to edit crontab in order to run my script hourly, sadly with no success.

Could anyone pls. drop me the crontab line which will execute script.xy every hour?

+2  A: 

If you're using Windows, why not use the built-in Scheduled Tasks (Accessories-System Tools)?

It may not show up immediately in the Wizard, but it is possible to set up tasks to be run hourly. Just add a daily task and then tick the "Open Advanced Properties" checkbox. Then go to the Schedule tab and again click "Advanced".

Jan
thx for the reply, actually I'm 'forced' to use cron. The customer wants it done this way so I'd have a hard time telling him not to.Anyways, is there a way to achieve this hourly thing within windows crontab?
KB22
Customers vary, but many of them use a word without really meaning something as specific as they say. I would not be surprised at all to learn that the customer had heard of cron, perhaps from using *nix at university, and was using it to mean "a thing that schedules jobs" but would not in fact mind if you used the Windows equivalent. It's always worth checking. WST under Win7 lets you add modifiers like whether or not you want to wake from sleep to run the task, whether the task should run even if you're on battery, and so on. It's very powerful, so could be a better choice.
Kate Gregory
A: 

I'd argue you probably don't want to be using Cron on Windows at all. Instead use a Scheduled Task (accessible through the Control Panel) and select your script.

Alternatively create a Windows service which runs your program hourly. I've never heard of people using Cron for Windows tasks in this way.

Mike McQuaid
A: 

Can't you use the Windows Task Scheduler instead of crontab? A commandline solution would look something like:

at 00:00 /EVERY:M,T,W,Th,F,S,Su yourScript.cmd
at 01:00 /EVERY:M,T,W,Th,F,S,Su yourScript.cmd
...

Notice that you have to schedule a new task for each hour. Anyone got a better soluition for this using the at command?

Ola Herrdahl
Ok, this won't solve your problem if you are stuck with crontab.Which implementation of cron are you using on windows?
Ola Herrdahl
+1  A: 

I figured it out: 0 * * * * C:\doSomeWork.script Makes the script run every full hour. Sometimes the easy way is the best... ;) thx anyway

KB22