My ILM_Scheduler service

I’m working on a great project at the moment – basically ILM is the provisioning engine sitting behind a self-registration system written in Sharepoint and built on SQL. This has finally given me the opportunity to re-write my simple ILM scheduler as a windows service!

The ILM_Scheduler service uses a SQL table as a task queue. It checks the queue every 30 seconds and runs any “queued” tasks it finds. I’ve added an XML file for configuring complex tasks, which may have multiple steps and sub-steps, and continue-on-error logic.

Some tasks (running an ILM run profile, running an SSIS package) are handled entirely in the service. I have also included the capability to shell out external processes – so you can queue any other executables or scripts you want to run.

The best thing about this queue approach is that I can start to make ILM behave more like a real time sync engine. Delta syncs can be queued as they are needed, rather than waiting for the next scheduled sync. There is also no danger of SQL blocking as I only allow one job to be running at a time.

So can I see the code?

I will post the source code after I’ve run it in production for a bit – and before that I have some vacation to take. 🙂

A System.Threading.Timer issue

Something I discovered while writing the service is that it’s not a good idea to use two System.Threading.Timers. One of them was supposed to fire every 30 seconds, and the other once an hour – but after a variable length of time they would both stop doing anything. In debug mode I could see a number of messages saying “The thread 0xnnn has exited with code 0 (0x0)”, so presumably both threads had crashed.

I was really trying to be too clever with the second timer anyway. I wanted to be able to queue a “Default Cycle” once an hour, but really it’s much easier to write a little vbscript which inserts jobs into the ILM Queue, and schedule that with the Windows Scheduler.

4 Replies to “My ILM_Scheduler service”

  1. Tried an entire day to debug. Just cant get the scheduler to work. Any ideas where I can start. Service is installed. SQL permissions verified. DB Created, Table Created, Service Start. Added ILM_Scheduler to q_executable column, add, AD_Imports to q_arguments column. I have looked at the code, but get no errors. It just does not work.

  2. If there is a new version or more manuals, please let me know. This version is either not stable code or badly documented. I understand it is freeware. Thanks for the hardwork.

  3. The problem resides in GetJobDetails. It fails to return any rows. Yet the caller have full permissions and the SQL statement execute just fine in SQL Query Windows.

  4. Hi – I’m sorry you’re having such trouble. The code is here more for inspiration than as a proper product. I haven’t installed it anywhere since the project it was written for (where it is still running with no problems) but I am just about to install it in a new environment, so I may refine it a bit.
    I just had a quick look at that Sub – is it not even writing the errors into the Event log? What happens when you go through with the debugger?
    Also what versions do you have? From memory this was written in VS 2005 with SQL 2005 running on Windows 2003.

Comments are closed.