This website uses cookies. Accept Cookies Find out more

Scheduled Tasks

Article Id:
KB204
Published:
12 Sep 2014, last updated 14 Sep 2021 13:31
Reading Time:
4 minutes, 25 seconds

Introduction

This article provides notes, documentation and guidance on scheduled tasks in Camino CMS. This includes the necessary steps required to getting scheduled tasks to work, how to create scheduled tasks and troubleshooting techniques.

What is a Scheduled Task?

A scheduled task is an operation or process that runs at a particular date and/or time or repetitively. In Camino, scheduled tasks are used to automate many management functions. For example, sitemap generation and pinging.

In Camino, there are broadly two different types of scheduled tasks:

  • Module tasks - these are created by Camino modules during their installation or upgrade and are used to deliver module-specific functionality
  • Custom or Manual tasks - these are created by site administrators.

Ordinarily, tasks created by a module cannot be edited, disabled or deleted as doing may impair the module's functionality. Manually created tasks may be created, edited and deleted at whim.

Automatic Triggering of Scheduled Tasks

Important: Scheduled Tasks requires another task scheduler to operate.

At first glance, this might produce an Eh? moment. As a website, Camino does not include any form of background process or service to trigger tasks. It is reliant on another scheduler calling an ASP.Net webform which in turn will run any required scheduled tasks.

This webform is called RunTasks.aspx and is located in the /App/Administrator/WebForms folder of Camino. Therefore, to call this page, you need to use an application or service to request the following address at a regular interval, ideally every 5 minutes:

http:///app/administrator/webforms/runtasks.aspx

There are number of options available to call the RunTasks address.

Marathon / Calzada Media Hosting Customers

If your Camino site is hosted by Calzada Media, then Scheduled Tasks will be automatically triggered using our Marathon service. If this is not enabled for your Camino site, contact support.

Windows Task Scheduler + WGET

If your Camino site is not hosted by Calzada Media and site administrators are in control of the host server, then an approach that is know to work is to use Windows Task Scheduler with WGET.

The basic principal is:

  • Download and installed WGET for Windows
  • Create a Windows Batch file contain the WGET command and the above address
  • Configure Windows Task Scheduler to run the batch file according to your desired schedule
    • If schedule is other than every 5 minutes, see below.

Trigger Period other than 5 minutes

If the interval for calling RunTasks.aspx is not 5 minutes, it is necessary to change the IntervalPeriod configuration option in RunTasks to match your trigger period. If the periods do no match, then there is the danger of some tasks not running or running multiple times:

  1. Edit /App/Administrator/WebForms/RunTasks.aspx.vb
    • This may be done using any text editor.
  2. Change the value of IntervalPeriod to match your trigger period
  3. Save the file. The new period will take effect the next time RunTasks is called

Managing and Monitoring Scheduled Task

Camino Administrator includes a task management page where site administrators may view a list of all tasks, create custom tasks and run any existing task.

  1. Log into Camino Administrator
  2. From the left-hand menu, click on Pages (Camino Starter users should click on Pages (Starter Edition)
  3. From the module (top) menu, select Tasks

The task management page displays a table of all configured tasks for the Camino site. This table includes key information including:

  • Count - this is the number of times the task has run or attempted to run
  • Last Run - the date and time (this is the server time) the task last ran

Viewing a task's detail and schedule

To view the details of an individual task, click on its' name in the table. This will take you to the Edit Task page that displays all available information for the task.

If the task is editable - most module tasks are not - then you are able to edit and change the task's detail and schedule.

Manually Running Scheduled Tasks

All scheduled tasks may be manually run through the task management page.

  1. Log into Camino Administrator
  2. From the left-hand menu, click on Pages (Camino Starter users should click on Pages (Starter Edition)
  3. From the module (top) menu, select Tasks
  4. Browse the list to locate the desired task.
  5. Click on the Run Task option for the relevant task

Creating a Manual Scheduled Task

Building the Code

To be able to create a scheduled task, you will need an ASP.Net User Control that either contains the functionality you wish to schedule, or calls the code that does. This user control should be uploaded to your Camino site, ideally within the /user/site/usercontrols/tasks folder. This folder may not exist, so it should be created.

Creating the Task

  1. Log into Camino Administrator
  2. From the left-hand menu, click on Pages (Camino Starter users should click on Pages (Starter Edition)
  3. From the module (top) menu, select Tasks
  4. Click on the Add Task button at the top of the page
  5. Complete the form and select your schedule.
    • For Target Control, enter the full relative address of your control. This should start with ~/
      • Example: For mycontrol.ascx, the value of Target Control would be ~/user/site/usercontrols/tasks/mycontrol.ascx
  6. Click on the Save Task button to create your new task.
 Loading ...
Copyright © 2011 - 2024 Calzada Media Limited. All Rights Reserved