如何在Autosys中创建全局变量?运行指定作业前需创建吗?
Hey there! Let's clear up your confusion about this Autosys job and global variables.
Do you need to create the global variable before running this job?
Nope, you don't. The job you've inherited is specifically designed to handle creating (or updating) the TEST_VARIABLE global variable on its own. Let's look at the key part of the job definition:
command: sendevent -E SET_GLOBAL -G TEST_VARIABLE=TRUE
The sendevent -E SET_GLOBAL command in Autosys does two things:
- If
TEST_VARIABLEdoesn't exist yet, it creates the global variable and sets its value toTRUE. - If the variable already exists, it overwrites its current value with
TRUE.
So running this job is exactly how you'd set up that global variable—no pre-work needed.
How to create Autosys global variables manually (if you ever need to)
While you don't need it for this job, here are two common ways to create global variables directly:
1. Using the command line
Log into a machine where you have Autosys client access, then run this command:
sendevent -E SET_GLOBAL -G TEST_VARIABLE=TRUE
If your variable value includes spaces or special characters, wrap the key-value pair in quotes:
sendevent -E SET_GLOBAL -G "TEST_VARIABLE=Hello World"
2. Using the Autosys GUI (Web UI or Java Console)
- Log into your Autosys console (the exact steps vary slightly by version, but the flow is similar)
- Navigate to the Global Variables section (usually under "Administration" or "Configuration" menus)
- Click "Create" or "Add" to make a new variable
- Enter the variable name (
TEST_VARIABLE) and its value (TRUE), then save your changes.
A quick note: Once created, you can reference this global variable in other Autosys jobs using the syntax $GLOBAL(TEST_VARIABLE).
内容的提问来源于stack exchange,提问作者user4900074

