Schedule a task
WayScript X allows you to configure your Lair to schedule task execution in minutes.

Create task.py

Use the boilerplate code below to create a task.py file in your Lair’s root directory. See File system for more details on how to manipulate files in your workspace file system.

Boilerplate task.py

1
# my-lair-a > task.py
2
3
i = 0
4
while i < 5:
5
print("This prints five times.")
6
i += 1
Copied!

Configure cron trigger

Open your Lair’s .triggers file and add a new cron trigger. Create a name for your trigger, input the following run command, and set an interval or custom cron syntax for your task. See Triggers for more details.
1
$ python task.py
Copied!

Test your task execution in development environment

Press “Run” to execute the run command and start your task’s process execution. Open your “Processes” list and select the running process to see the generated log.

Deploy to production environment

Your task will not be scheduled within your Lair’s development environment. Once you have finished testing, press “Deploy” to create a production environment for your task. See Hosted environments for more details.
Last modified 1mo ago