jollyrancher82 Posted April 1, 2008 Share Posted April 1, 2008 I have been working on a Cron implementation for Windows using C# and the .NET 3.5 framework. It will offer similar functionality to the Unix Cron daemon, but for Windows. A unique part of my implementation of Cron is the XML configuration file which is XML rather than plaintext. Below is an example CronTab.xml. <?xml version="1.0" encoding="UTF-8"?> <CronTab> <!-- Run SomeExecutable.exe every quarter past the hour --> <CronJob> <Schedule> <Minute>15</Minute> <Hour>*</Hour> <DayOfMonth>*</DayOfMonth> <Month>*</Month> <DayOfWeek>*</DayOfWeek> </Schedule> <Task arguments="--some-argument">C:Program FilesSomeAppSomeExecutable.exe</Task> </CronJob> <!-- Run SomeBatchFile.bat every 5 minutes on Sunday --> <CronJob> <Schedule> <Minute>*/5</Minute> <Hour>*</Hour> <DayOfMonth>*</DayOfMonth> <Month>*</Month> <DayOfWeek>7</DayOfWeek> </Schedule> <Task arguments="">C:SomeBatchFile.bat</Task> </CronJob> </CronTab> I use LINQ to XML to parse this, and further string parsing for the schedule elements. The first release will have some limitations which will be outlined when it is released, but should be sorted out before the second release. Below is a screenshot of the class diagram for the Cron service. http://farm3.static.flickr.com/2354/2378370591_7f1591947e.jpg[/img] The first beta of my Cron service should be available before the end of the week. I am also going to be adding such functionality as recoverability and email notification in the release after the beta, after any bugs that have been found are fixed. If you have any other sensible suggestions for features, please contact me. Quote Link to comment Share on other sites More sharing options...
SomeoneE1se Posted April 1, 2008 Share Posted April 1, 2008 so with cron that requires an XML in stead of the * * * * * c:commandprogram.exe Quote Link to comment Share on other sites More sharing options...
jollyrancher82 Posted April 1, 2008 Author Share Posted April 1, 2008 An alpha testing version is out: http://tombell.org.uk/~tomb/binaries/cron/CronService.msi Install this, it requires the .NET 3.5 Framework, and then download and copy this file: http://tombell.org.uk/~tomb/binaries/cron/Cron.exe Over the top of Program FilesTom BellCronCron.exe as it is an update and I haven't made the new installer. The configuration file is CronTab.xml, and you can start the service like any other windows service. Quote Link to comment Share on other sites More sharing options...
SomeoneE1se Posted April 2, 2008 Share Posted April 2, 2008 because it's windows can I haz a xml gui job manager? Quote Link to comment Share on other sites More sharing options...
jollyrancher82 Posted April 2, 2008 Author Share Posted April 2, 2008 because it's windows can I haz a xml gui job manager? Sure if you make one. Quote Link to comment Share on other sites More sharing options...
Mooblar Posted April 2, 2008 Share Posted April 2, 2008 The idea is nice :> Quote Link to comment Share on other sites More sharing options...
jollyrancher82 Posted April 3, 2008 Author Share Posted April 3, 2008 Unix Cron has email notification. I was wonder which of these configuration people would prefer. <CronTab> <!-- Ping 'google.com' every 5 minutes of every day --> <CronJob> <Schedule> <Minute>*/5</Minute> <Hour>*</Hour> <DayOfMonth>*</DayOfMonth> <Month>*</Month> <DayOfWeek>*</DayOfWeek> </Schedule> <Task arguments="google.com">ping</Task> <EmailSettings> <SmtpHostname>smtp.gmail.com</SmtpHostname> <SmtpPort>587</SmtpPort> <SmtpUsername>funkygmailaccount@gmail.com</SmtpUsername> <SmtpPassword>lamepassword</SmtpPassword> <UseSsl>true</UseSsl> </EmailSettings> </CronJob> </CronTab> One email settings per Cron job, or <?xml version="1.0" encoding="UTF-8"?> <CronConfig> <EmailSettings> <SmtpHostname>smtp.gmail.com</SmtpHostname> <SmtpPort>587</SmtpPort> <SmtpUsername>funkygmailaccount@gmail.com</SmtpUsername> <SmtpPassword>lamepassword</SmtpPassword> <UseSsl>true</UseSsl> </EmailSettings> </CronConfig> A separate single configuration. Quote Link to comment Share on other sites More sharing options...
SomeoneE1se Posted April 3, 2008 Share Posted April 3, 2008 can we have it as a default with an override on specific jobs? Quote Link to comment Share on other sites More sharing options...
jollyrancher82 Posted April 3, 2008 Author Share Posted April 3, 2008 First revision of documentation: http://tombell.org.uk/~tomb/binaries/Cron/...cumentation.pdf Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.