# Scheduletask concept

You need to create a total of 21 tasks in Lucee. That may sound like a lot, but read this chapter to find out why.

You will find all the files for the schedule tasks in the "scheduletasks" folder.

### Task for subscriptions and other

The main task takes place every 2 hours. It has the following tasks to complete:

* Downgrade plans on waiting list
* Renewing plans
* Renewing modules
* Delete after cancellation
* Set status for expired plans
* Check open invoices (overdue)
* Delete logfiles older than 30 days

Please create a schedule task in Lucee that calls the file subscriptions.cfm **every 2 hours**:

```
https://yourdomain.com/scheduletasks/subscriptions.cfm?pass=xxx
```

You define the password xxx in the URL variable in **config.cfm**

### 20 parallel running tasks

The system is designed so that various tasks from the modules can take place for a large number of customers.

Example: You develop an interface to MailChimp and want all customers and their email addresses to be transferred to MailChimp on a periodic cycle. This should be carried out once every night, which should be done by a schedule task. You have created a file and want it to be executed for all customers who have purchased/subscribed to the module (i.e. the interface).

Now assume you have 1000 customers who have subscribed to the module. If you were to create just 1 schedule task to run the file once every night for all customers, this could possibly take a very long time, which could lead to the server being cancelled or even crashing.

The solution here is to process the tasks in parallel. The customers are distributed across 20 tables. The 20 schedule tasks now process the 1000 customers in parallel, so each task only has to process 50 customers instead of 1000 in serial mode.

So, please set up 20 schedule tasks, which are executed every 2 minutes:

```
https://yourdomain.com/frontend/core//tasks.cfm?task=01&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=02&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=03&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=04&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=05&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=06&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=07&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=08&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=09&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=10&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=11&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=12&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=13&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=14&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=15&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=16&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=17&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=18&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=19&pass=xxxx
https://yourdomain.com/scheduletasks/tasks.cfm?task=20&pass=xxxx
```

You define the password xxx in the URL variable in **config.cfm**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.saaster.io/fundementals/scheduletask-concept.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
