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

Deploy
schedulerx-agenton each target machine. The agent communicates with the SchedulerX server, receives script execution commands, and returns results.Install all script dependencies on the machine, such as Python libraries or other required files.
For each execution,
schedulerx-agentforks a child process to run the script. The child process does not consumeschedulerx-agentmemory, but it does consume machine memory. Actual memory usage depends on the script.
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:
A deployed SchedulerX agent. For setup instructions, see Use the SchedulerX agent to connect an application to SchedulerX (Script or HTTP jobs)
Create a script job
Log on to the Distributed Task Scheduling Platform.
In the left-side navigation pane, click Task Management.
On the Task Management page, create a job.
Set Task type to ScriptTask.

Select a script language
From the Script drop-down list, select shell, python, or php.
| Language | Default command | Alternatives |
|---|---|---|
| Shell | /bin/sh | -- |
| Python | python | python2, python3 |
| PHP | php | -- |
Select a file format
Set File format based on the operating system where the script runs. This setting controls the line ending character.
| Target OS | File format |
|---|---|
| Linux, Unix, or macOS | unix |
| Windows | windows |
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.
| Mode | Behavior | Use case |
|---|---|---|
| Stand-alone operation | SchedulerX randomly selects one agent to run the script. | Single-machine tasks |
| Broadcast run | SchedulerX sends the script to all agents and runs it on every machine simultaneously. | Batch O&M across all machines |
| Shard run | SchedulerX 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.

Manage historical script versions
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.

Examples
Distributed processing with broadcast run
This example runs a shell script on two agents simultaneously using broadcast mode.
Connect two
schedulerx-agentinstances.Create a script job with the following settings:

Script: shell
Execution mode: Broadcast run
In the Operation column, click Run once.
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.
Logs for
172.16.13.120: shard ordinal = 0, total shards = 2.
Distributed processing with shard run
This example distributes named shards across two agents.
Create a script job with the following settings:

Script: shell
Execution mode: Shard run
Click EditScript for the job and enter the script content.

In the Operation column, click Run once.
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.120processed thehangzhouandbeijingshards.172.16.13.125processed theshenzhenandshanghaishards.
