All Products
Search
Document Center

SchedulerX:Script jobs

Last Updated:Mar 11, 2026

When you need to run Shell, Python, or PHP scripts across distributed infrastructure on a schedule, embedding scripts in application code adds unnecessary complexity. Script jobs in SchedulerX let you author, version, and schedule scripts centrally, then distribute them to one or more agents for execution -- without modifying your applications.

How it works

Architecture diagram
  1. Deploy schedulerx-agent on each target machine. The agent communicates with the SchedulerX server, receives script execution commands, and returns results.

  2. Install all script dependencies on the machine, such as Python libraries or other required files.

  3. For each execution, schedulerx-agent forks a child process to run the script. The child process does not consume schedulerx-agent memory, but it does consume machine memory. Actual memory usage depends on the script.

Note

If many script jobs run simultaneously, the machine may run out of memory. For resource-intensive workloads, use Kubernetes jobs to run scripts in pods instead.

Prerequisites

Before you begin, make sure that you have:

Create a script job

  1. Log on to the Distributed Task Scheduling Platform.

  2. In the left-side navigation pane, click Task Management.

  3. On the Task Management page, create a job.

  4. Set Task type to ScriptTask.

Job creation page with ScriptTask selected

Select a script language

From the Script drop-down list, select shell, python, or php.

LanguageDefault commandAlternatives
Shell/bin/sh--
Pythonpythonpython2, python3
PHPphp--

Select a file format

Set File format based on the operating system where the script runs. This setting controls the line ending character.

Target OSFile format
Linux, Unix, or macOSunix
Windowswindows
Important

If the script is authored on a Windows system but runs on a Linux system, select unix.

Select an execution mode

Set Execution mode to control how the script runs across agents.

ModeBehaviorUse case
Stand-alone operationSchedulerX randomly selects one agent to run the script.Single-machine tasks
Broadcast runSchedulerX sends the script to all agents and runs it on every machine simultaneously.Batch O&M across all machines
Shard runSchedulerX distributes shards across agents. Each agent processes its assigned shards.Parallel data processing. See Create a Python sharding job.

Write and edit scripts

After you create a script job, SchedulerX generates a default script template based on the selected language. To modify the script, click EditScript on the Task Management page.

EditScript button on Task Management page

Manage historical script versions

Note

This feature is available only for Professional Edition applications.

On the EditScript page, turn on the Historical versions switch to open the version comparison view.

  • The left side displays the current version. The right side displays a historical version.

  • Select a historical version from the drop-down list. Each entry shows the version notes and creation time.

  • After you modify the script, click Confirm. Enter a version name when prompted.

Historical versions comparison page

Examples

Distributed processing with broadcast run

This example runs a shell script on two agents simultaneously using broadcast mode.

  1. Connect two schedulerx-agent instances.

  2. Create a script job with the following settings: Broadcasting demo script content

    • Script: shell

    • Execution mode: Broadcast run

  3. In the Operation column, click Run once.

  4. In the left-side navigation pane, click Execution List. On the Execution List page, click Log in the Operation column to view the output from each machine.

    • Logs for 172.16.13.125: shard ordinal = 1, total shards = 2. Broadcasting logs for 172.16.13.125

    • Logs for 172.16.13.120: shard ordinal = 0, total shards = 2. Broadcasting logs for 172.16.13.120

Distributed processing with shard run

This example distributes named shards across two agents.

  1. Create a script job with the following settings: Sharding demo job configuration

    • Script: shell

    • Execution mode: Shard run

  2. Click EditScript for the job and enter the script content.

    Sharding demo script content

  3. In the Operation column, click Run once.

  4. In the left-side navigation pane, click Execution List. On the Execution List page, click Log in the Operation column to view how shards were distributed.

    • 172.16.13.120 processed the hangzhou and beijing shards.

    • 172.16.13.125 processed the shenzhen and shanghai shards.

    Sharding demo logs

References