Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database / SQL-Server

Zeta Scheduler

4.84/5 (41 votes)
21 Dec 2011CPOL13 min read 114.1K  
An application that helps you in starting tasks at predefined times and with various dependencies.
Image 1
Click for large image.

Introduction

Zeta Scheduler (ZS) is an application that helps you in starting tasks at predefined times and with various dependencies. In contrast to the Windows Task Scheduler, ZS has more/other features that makes it more flexible, providing features that are not available otherwise.

History

We started developing ZS for a client after he found no state-of-the-art replacement for a tool called "Norton Scheduler" which dated from around mid 1990's. We found no other tool available on the market that matches the features of Norton Scheduler and the new requirements of our client.

Therefore we developed ZS together with our client.

Current State of the Tool

Currently, Zeta Scheduler is in public beta test.

This means:

  • You can use it free of charge.
  • The installation process requires you to perform manual steps.
  • The documentation is spare.
  • Bugs may still exist.
  • Some features are still missing.

Overview

ZS consists of two applications: An application called Zeta Scheduler Manager (ZSM) and an application called Zeta Scheduler Scheduler (ZSS).

ZSS is a console application that is running on each computer that you want to run scheduled tasks. ZSM is a Windows GUI application that is running on one computer to manage all computers running ZSS.

In addition, a central Microsoft SQL Server database is being accessed by all ZSS and ZSM instances to read and write configuration settings.

Features

Schedule Modes

ZS allows for defining tasks that can execute either depending on date/time settings or depending on each other. The following modes are supported:

  • Run once at a given date.
  • Run yearly at a given date.
  • Run monthly at configurable days at a configurable time.
  • Run daily or weekly at given weekdays at a given time.
  • Run hourly every n hours.
  • Run at a variable dates/times. This is a highly configurable mode, where you can set weekdays, month days, and multiple hours and minutes independently.
  • Run at system start, n minutes after the computer started.
  • Run dependent on another task. This mode allows to chain multiple tasks, allowing to start a certain task only upon success or failure of a previous task.

In addition, you can configure a task to not run on public holidays (which are configurable, too).

Notifications

Each task can be configured to generate notifications upon successful finish and/or when finished with errors. Notifications can be sent to any of the following targets:

  • By e-mail to one or multiple receivers
  • A log file
  • A database table (To e.g. evaluate later with 3rd party tools)
  • The window event log

Each notification can be configured to be sent to multiple targets simultaneously with configurable notification texts.

Jobs

The concept of a "job" contains all the definitions of an actual task to be scheduled. A job is contained in a global repository of jobs, allowing to easily assign one job to multiple tasks (optionally on different computers) thus simplifying the creation and assignment of tasks.

A job contains the following major settings:

  • Name and category - Helps in categorizing and quickly finding jobs.
  • Program file, command line, startup folder - The core definition of the application/script to execute.
  • Result ranges - To specify the exit codes that you consider as "success" and as "failure".
  • User login information - To run the process as another user.

Computers

A "Computer" identifies a machine that is running the ZSS application. In the central ZSM management application, you can create an arbitrary number of computers and assign tasks to it.

Settings for a computer contain:

  • An IP address or host name
  • A friendly name
  • A description
  • A flag to activate/deactivate all tasks

Placeholders

For most settings (like job definitions or notification settings), you can use placeholders that are expanded during runtime. This enables you to minimize hardcoding of information, making the application easily transferable to other systems.

Some example placeholder among the more than 70 placeholders include:

  • Environmental information like computer name, environment variables, operation system version, IP address
  • Global information like current date or time
  • Path information like current ZSS file and folder path
  • Task information like name or last result
  • Job information like ID or user name

Various Other Features

  • Detailed result history of tasks that ran in the past. The history is stored in the database so that you can use 3rd party tools to further process the results.
  • Ribbon UI for easy usage.
  • Great, fast, responsive support from friendly support engineers.

Installation

Preface

This section assumes that you are familiar with:

  • Basic Microsoft Windows Server 2003/2008 operating system administration
  • Microsoft .NET Framework 4.0 administration
  • Microsoft SQL Server 2005/2008 administration

Requirements

To successfully set up the ZSM and the ZSS components, you need the following prerequisites:

  • Microsoft Windows Server 2003/2008, Microsoft Windows XP, Microsoft Windows Vista or Microsoft Windows 7
  • Microsoft.NET Framework 4.0
  • Microsoft SQL Server 2005/2008

The setup components package consists of:

  • ZIP archive with the server components, consisting of a complete ASP.NET application (with ASPX files, DLLs, configuration file, etc.)
  • An SQL Server database backup of the Zeta Scheduler database with the structure but no data.
  • This document.

Steps

Download and Run the Deployment Setup

First, download the deployment setup and run it. The deployment setup brings all the required files to your local computer (to the desktop by default) but does not actually install any components. This must be done manually during the beta stage.

After you run the deployment setup, you find the following child folders in the installation folder (default: "C:\Users\YourLogInName\Desktop\Zeta Scheduler"):

  • "Manager" - The executable for the ZSM application
  • "Scheduler" - The executable for the ZSS application
  • "Database" - The Microsoft SQL Server 2005/2008 script to create the objects of the ZS database

Install the Database

In order to install the database, follow these steps:

  1. Select a Microsoft SQL instance that is accessible by the computer where you plan to install the ZSM application as well as by all computers that will be running the ZSS application.
  2. In Microsoft SQL Server Management Studio, create a new Database "ZetaScheduler".
  3. Next, open and run the script "ZetaScheduler.sql" in the "Database" folder that was delivered by the deployment setup.

You have successfully configured the database structure. Please ensure that you add the new database to your maintenance plan to ensure it will be backed up.

Configure the ZSM Management Application

The ZSM management application is your central GUI for configuring and administering all ZSS instances. To install, perform the following steps:

  1. Move content of the "Manager" folder from the deployment setup to an appropriate location, e.g. "C:\Program Files\Zeta Scheduler Manager".
  2. Open the "zsm.exe.config" configuration file with an (XML) text editor (e.g. Notepad or another text editor like "Notepad++" - but not with e.g. Wordpad or Microsoft Office Word, since the content will be rendered unusable).
  3. Adjust the connection string to point to your previously installed Microsoft SQL Server instance.
  4. Optionally, adjust the "zsm.logging.config" file that defines how/whether internal logging should be performed. See the log4net website for a complete set of available logging configuration settings.

The default connection string to adjust in item 4.) reads:

C#
connectionString="data source=EnterYourDBServerHere;
    initial catalog=EnterYourDatabaseHere;
    Integrated Security=False; 
    User ID=EnterYourUserIDHere; 
    Password=EnterYourPasswordHere"

If you are unsure how to exactly form your connection string, you may want to visit the website ConnectionString.com which contains various examples.

Deploy the ZSS Scheduler Application

For each computer where you want tasks to be scheduled with ZS, you have to copy and configure an instance of the ZSS executables:

  1. Copy content of the "Scheduler" folder from the deployment setup to an appropriate location, e.g. "C:\Program Files\Zeta Scheduler".
  2. Open the "zss.exe.config" configuration file with an (XML) text editor.
  3. Adjust the connection string to point to your previously installed Microsoft SQL Server instance.
  4. Optionally, adjust the "zss.logging.config" file that defines how/whether internal logging should be performed.
  5. Create an entry in the Windows-built-in Task Scheduler pointing to "zss.exe" and configure it to "run on system startup". This ensures that the core scheduling engine is always present. (We will replace this with an actual Windows service in future versions.)

Repeat the steps 1. to 5. for each computer where you want tasks to be executed with ZS.

Troubleshooting

If you have errors during installation, check the following items:

  • Inspect the Windows Event Log for detailed error messages.
  • Inspect the log files that the ZS components write.
  • Visit the official support area and ask for further assistance or simply post your question in the comments section at the very end of this article.

Configuration

Once you have successfully installed the database, ZSM and the ZSS instances, you have an empty installation that you have to configure before actually running.

This chapter tells you how.

The ZSM Main Window

The main window of the ZSM management application consists of a ribbon menu at the top of the window. Use the ribbon menu items to perform various actions.

Below the ribbon area is the main tree list that displays all computers, tasks and child tasks. The columns from left to right display information about the state of a task and other useful values.

On the left side of each node in the main tree list, a colored square icon is being displayed which shows the cumulated state of an element and all child elements in an easy-to-remember traffic light color range:

  • Gray icon - The computer/task contains no result (i.e. no tasks or tasks that never run).
  • Red icon - The element (or a child element) ran and exited with an exit code that is being interpreted as "failure". An element is red as soon as one child element is red, even if other child elements are green.
  • Green icon - The element (and all child element, if any) ran and exited with an exit code that is being interpreted as "success".
  • Yellow icon - Some child elements exist that are green and some that are gray.

Create a Computer

Create a new root element "computer" for each computer where you have a ZSS instance running:

  1. On the main ribbon, click "Add computer".
  2. Enter the host name or the IP address of the computer.
  3. Give the computer an meaningful name, e.g. the host name.
  4. Optionally enter remarks for your own comfort.

Define Jobs

Jobs are the building blocks for the actual tasks. Define one or more jobs to later use them when defining tasks. Each job can be used by multiple tasks.

  1. In the main ribbon click "Jobs".
  2. The jobs window opens. Click "New" button to add a new job.
  3. Enter a name for the job to identify it later.
  4. Enter a program's full path to program to start. Use placeholders to make it usable on multiple computers even with slightly different configuration. Enter e.g. "$(SpecialFolder.System)\notepad.exe" to point to the Windows Notepad application.
  5. Specify optionally arguments and a startup folder path.
  6. Tell ZS which exit codes from the program to interpret as "success" and which as "failure". Usually this information depends on the program you actually plan to run and is provided by the manual for the program. Ask its vendor for further details.
  7. Optionally configure a user (user name, password, domain) to start the program with. If you omit this information, the program will be started with the same user context as the ZSS application is running.

Repeat those steps to add all required jobs. Of course you can define jobs later as you need them.

Define Notifications

Notifications enable you to configure whether/how the successful/erroneous exit of a task will be notified. You define notifications in a global repository and assign them later to the actual tasks to run.

To define a notification:

  1. In the main ribbon, click "Notifications".
  2. The notifications window opens. Click the "New" button to add a new notification.
  3. Enter a name for the notification to identify it later.
  4. Configure which notifications will be sent out to which destinations.
  5. Configure the notification texts that will be sent out.

To configure global notification settings:

  1. In the main ribbon, click "Notifications".
  2. The notifications window opens. Click the "Setting" tab page to show all available notification configurations.
  3. Enter the e-mail (SMTP) server settings and the log file settings.

Please note that the notification settings are being used for all computers running the ZSS application. This means that when e.g. configuring an SMTP server you have to ensure that all computers are allowed to send e-mail messages through this server.

Define Tasks

After you have defined your jobs which serve as the base for the tasks, you can start adding tasks.

Since tasks can be added both to computers as root tasks and to other tasks as child tasks, it is important which element you select in the main window tree list.

Adding Root Tasks to Computers

To add a root task to a computer, perform the following steps:

  1. Select the computer in the main window by left-clicking it.
  2. In the main ribbon click "Add task".
  3. Give the task a name to identify it later.
  4. Select a predefined job from the list. This job is executed for the conditions you configure in the task. If you want to add a new job, click the "Jobs" button.
  5. Click the "Scheduled times" tab page.
  6. Enter/select the scheduling times of the task.
  7. Optionally, click the button "Save and recalculate" to verify the actual schedule dates that the task will be executed.
  8. Click the "Further settings" tab page.
  9. Optionally configure notifications to be sent out upon successful or erroneous exit of the program to run.

Repeat the above steps for all root tasks you want to add.

Add Child Tasks to Tasks

To add a child task to an existing task, follow these steps:

  1. Select the task in the main window by left-clicking it.
  2. In the main ribbon, click "Add task".
  3. Give the task a name to identify it later.
  4. Select a predefined job from the list. This job is executed for the conditions you configure in the task. If you want to add a new job, click the "Jobs" button.
  5. Click the "Scheduled times" tab page. For child tasks, only one option "Dependent" is available.
  6. Configure the scheduling time.
  7. Optionally, click the button "Save and recalculate" to verify the actual schedule dates that the task will be executed.
  8. Click the "Further settings" tab page.
  9. Optionally configure notifications to be sent out upon successful or erroneous exit of the program to run.

Repeat the above steps for all child tasks you want to add. Please note that you can nest tasks indefinitely.

Compiling the Source Code

In order to compile and run the provided source code by yourself, the following requirements must be present:

You also need to set up and configure a database and adjust the ZSM and ZSS configuration files just as previously described in the "Setup" section.

The used Zeta Enterprise Library is also available in a separate article.

Epilog

In this article, I've introduced a replacement/extension to the Windows Task Scheduler.

When voting, please notice that I put my article in the "Utilities" section, so I assume it is safe to not post any source code explanations in the article itself. Thanks.

Source Code Size/Location

A last word about the source code: Since the source code is approx. 30 MB, I decided to put it on an external server since it exceeds the allowed size limit of CodeProject.com.

The reason for the large size is that the download contains DLLs to allow for successful compilation of the Visual Studio solution.

So my decision was to prefer a compilable code over size. If you disagree, please comment and I will provide an alternative source download.

History

  • 2011-12-22 - Maintenance release, updated to the latest source code and DevExpress components.
  • 2010-07-10 - Added missing SQL script, migrated to .NET 4.0, moved to Office 2010 Ribbon UI style.
  • 2010-04-14 - Maintenance release, updated to latest DevExpress components.
  • 2009-11-18 - Minor fixes.
  • 2009-11-16 - First release on CodeProject.com.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)