Hourly cronjob on Windows - windows

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?

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".

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

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.

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?

Related

Issue with windows tasks scheduler

I want to run powershell script every day and want to use task scheduler for it. But I have to be log in because this srcipt runs cisco vpn client and putty and then runs some python script for one minute. I don't want it to interrupt my work (because it swichs to different vpn etc.) so I set up time to run this task to 2:00 AM and check "run asap after a scheduled start is missed" to make sure that this task will run every morning after I turn on my computer.
But the problem is, that it doesn't run the script after turn on PC and it says event id 332 - Launch condition not met, user not logged-on. I think I understand this problem, it tries to run this script right after start up so at time I'm not log in. But why does not the task try it after 1 minute again up to 3 times? (see below)
What shoud I do to make sure that it will run every day after turn on PC but only once a day (sometimes I need to restart my PC so I don't want it to run again)
There is my task configuration:
Check the 'Run whether the user is logged on or not' and 'Run with highest privilege' options.it will work for you.

Run console application automatically in windows

Is it possible to automatically run a console application on a particular time in a day.
With out set up any sheduler !
Not without any scheduler; something needs to invoke it.
Alternatively, you can write a separate app that runs on startup and starts your app for you at the desired time. This would mean that this background app would always be open.
Using the scheduler would be much easier.
If with "set up any scheduler" you refer to not installing something to do the schedule, there is no need to do that. Windows include it own scheduler.

Windows Scheduled Task and Console Application

I'm creating a simple job that I'd like to run every 60 seconds (1 minute). Instead of approaching this using a Windows Service Installer program, I'd like to create a Console App that is run through Windows Scheduler.
What will happen if a job kicks off and it takes more than 60 seconds to process? Will a second instance of a job kick off again? I'd like Windows to manage the job in a manner such that a second instance of a job won't kick off until the first one is complete.
Does this make sense? Will the Windows Task Scheduler use this approach by default?
Thanks all.
Yes, Windows will start a new instance by default; however, you can control that behavior. In Control Panel, go to Task Scheduler. Find any time-scheduled task and right click/Properties, then choose the Settings tab. At the bottom, you'll see an option named "If the task is already running, then the following rule applies." You can choose to not start a new instance, run a new instance in parallel, queue a new instance, or stop the existing instance. You want the first choice. The Windows Task Scheduler API provides the same functionality.

cronJob on windows

i wanna to create a cron job on windows that daily delete files from a specific folder.
how can i do this??
Thanks in advance
Use Schedule tasks in windows. Check here. You can use del command to remove one or more files. Put it inside a batch script and schedule it as a task.
You want Scheduled Tasks.
With Scheduled Tasks, you can schedule
any script, program, or document to
run at a time that is most convenient
for you. Scheduled Tasks starts every
time that you start Windows XP and
runs in the background, and it starts
each task that you schedule at the
time that you specify when you create
the task.
Edit your question if you specifically need help with the deleting files bit, but typing in help del at a command prompt should tell you everything you need to know.
I use Cron for Windows, it's very easy to use if you are familiar with cron from *nix

How do you schedule a daily script run on Windows XP?

I wrote a script in Ruby. I'd like to run it every day at a certain time. How do you do that on a Windows XP system?
I poked around on the machine and discovered the "scheduled tasks" control panel, but it doesn't seem to have anything to do with running scripts, as far as I can tell from the options offered by the "wizard".
Scheduled Tasks. Sometimes, you have to make a batch file call the script, and schedule the batch.
say you have "script.vbs" you want to run, you will have to create this batch:
cscript script.vbs
cscript is the windows script host which interprets the vbs script. I'm sure ruby has something similar.
You can do it with scheduled tasks, just browse for the program or script you want to run if it isn't listed (in this case, the ruby interpreter I guess, and add the name of the script to run as an argument).
Use the Windows task scheduler.
Under Control Panel > Schedule Tasks.
You can set it up to run any application or file executable from the command line.
Update: (1/15/09)
A good point from Wouter van Nifterick, remember to take care that the process finishes before the next one runs (in comments).
This can be done by going into the advanced options and adjust the allowed amount of time the task may run.
If the task is already configured open it and click the Settings tab. At the top of this tab you will see a checkbox followed by 'Stop the task if it runs for:' then there are two text boxes to enter hours and minutes. If your script runs once a day you will want this set to 23 hours or so.
The 'at' command is a nice command line version of a scheduler.

Resources