Cron Jobs

Windows Scheduled Task Monitoring

Windows Scheduled Task monitoring is easy with Cronitor. Our web dashboard provides you with better visibility into your tasks, and we'll send instant alerts if any goes wrong, including:

  • The task does not start on schedule
  • The task fails or crashes unexpectedly
  • The task runs longer than expected

How to Create a Windows Scheduled Task Monitor

  1. Determine the schedule that your task is running on. This can be found in the Task Scheduler interface. In this example, the task runs every 2 minutes.

  2. From the Cronitor dashboard, click the button to create a new monitor and select Scheduled Task

  3. Add a Complete endpoint not pinged in 2 minutes rule. Optionally, add a Runs for longer than rule to identify tasks that run longer than expected.

  4. Give the monitor a descriptive name like Offsite Backup and add optional tags or notes and hit "Save".

  5. You're done! Your monitor will be assigned a unique ping url and be placed in a pending state. Monitoring will begin when the first ping is received.

Adding Cronitor to your Scheduled Task

On your server, download the CronitorCLI application. We recommend moving the executable to %SystemDrive%\Program Files\ for system-wide use. From the Task Scheduler, update the scheduled task action you are monitoring to invoke CronitorCLI:

  1. Right click the desired scheduled task, select Properties, select Actions, select the first action listed, click "Edit".

  2. Turn the command being invoked into an argument to cronitor exec. In this example you see that the C:\app\bin\collect-stats command is now being passed as an argument to CronitorCLI. the first argument after exec, d3x0c1, is the unique key for this monitor, copied from the Cronitor dashboard.

    Program/scriptArguments
    BeforeC:\app\bin\collect-statsPRODUCTION
    AfterC:\Program Files\cronitor.exeexec d3x0c1 C:\app\bin\collect-stats PRODUCTION

    Before you are running C:\app\bin\collect-stats directly: After integration you are using CronitorCLI to run the command:

  3. If your scheduled task has multiple actions listed, repeat this step for each action.

  4. If possible, run your task manually from the Task Scheduler to ensure that it works properly. You should see the details from the run on your Cronitor dashboard within a few seconds.

Tip: Cronitor integration can be accomplished without installing CronitorCLI. To do this, move your current command and arguments to a .bat file, and using curl or similar to ping to your monitor's unique /run endpoint before your task runs, and ping /complete after it exits.

Previous
Java Cron Jobs