The Cron Service for windows has been updated. To see what we have added, visit the announcement page
If you spend any amount of time working with Unix, you will come across Cron and the CronTab file.
What is it?
Cron allows you to schedule programs to run at specified intervals, like every Sunday at 1AM.
Now I can already hear it…”Steve, that is what the task scheduler is for in Windows”
While it is true you can schedule tasks in Windows, one big issue with task scheduler is how do you transfer scheduled tasks from one computer to another?
You could copy the folder c:\windows\tasks, but this is totally unsupported and it does not always work.
That is the beauty of Cron. Every bit of scheduling info is contained within the Crontab file.
If you want a group of servers to have the same scheduled jobs, you just need to sync this file. No registry hacks, no tricks. Just one file.
Not only that, since it is just a simple text file you can easily schedule jobs from PHP, PowerShell or VBScript…without any ActiveX or hooks into Windows. You just need to modify a simple text file.
There are a few Windows implementations out there…but most of them are quite old. We wanted something that would work on 2000 through 2008 x64 – so we built our own 🙂
To use it, download the setup file from our downloads page:
The install does not create any icons, or shortcuts. It installs all the application files into
c:\program files\IntelliAdmin\Cron by default, and automatically starts the cron service (Named icronsvr).
The file that tells it what to do is the ‘crontab’ file. It roughly follows the same format as the Unix crontab
The file is formatted in this way:
[M] [H] [D] [M] [DOW] [Process Name] [Process Arguments]
M – The minute that the process should be executed (0-59)
H – The hour that the process should be executed (0-23)
D – The day that the process should be executed (1-31)
M – The month that the process should be executed (1-12)
DOW – The day of the week that the process should be executed (0-6 Sunday = 0, Monday = 1, Etc)
Note: Our format does not support names such as THU, or JAN…only numerical values
Each section can:
-Have a range of values like this: 12-24 (All items from 12 to 24)
-Have a list of values like this: 12,13,14,15
-Include all possible values like this: *
-Skip values using the / like this: 0-59/5 (This would only include 0,5,10,15,20,etc)
Lets put it all together. If we wanted a process to run every 5 minutes we would create a line like this in our crontab file:
*/5 * * * * "c:\windows\system32\cmd.exe" "/c c:\test.bat"
See how the skip value works? We specified the * for the minute section (All minutes), and then told it to skip 5. This means it will run at 0, 5, 10, 15, 20, etc.
If you wanted to run a process every Sunday at 1 pm:
00 01 * * 00 c:\process.bat
Or how about, only every Sunday from June to the end of the year:
00 01 * 06-12 00 "c:\windows\system32\cmd.exe" "/c c:\test.bat"
At 15, and 30 minutes past every hour:
15,30 * * * * "c:\windows\system32\cmd.exe" "/c c:\test.bat"
This might give you a clearer picture:
* * * * * C:\SomeEXE.EXE ARG1 ARG2 ARG3 - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +------- month (1 - 12) | | +--------- day of month (1 - 31) | +----------- hour (0 - 23) +------------- min (0 - 59)
It takes a little time to get used to the format, but once you do it is a breeze to work with.
A few things to think about when using this:
-Make sure you secure the crontab file by only allowing ‘System’ and Administrator write access. Otherwise a standard user could simply alter the crontab file and start running stuff as ‘System’
-The programs are run in the context of a service. By default the user account is ‘System’, and for security reasons it does not have network share access. If you want to allow access to network shares you would have to go into the settings of the IntelliAdmin Cron Service, and have it login as a user with the appropriate rights.
-Since it is a service, make sure your program does not pop up forms or message boxes…otherwise they will just get stuck and you will never see them. Test…test…test before you deploy.
If you have any other features you would like to add to this little tool, let us know and we will see what we can do.
One more thing…Subscribe to my newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them. Click Here to get your free tools