

C-LANG Statements › SCRIPTNAME Statement—Specify a UNIX Shell Script to Run
SCRIPTNAME Statement—Specify a UNIX Shell Script to Run
The SCRIPTNAME statement specifies the UNIX shell script to run.
Supported Job Type
To run shell scripts, this statement is required for the UNIX job type.
Note: All UNIX job definitions require a SCRIPTNAME statement or a CMDNAME statement. Use the SCRIPTNAME statement to run shell scripts and the CMDNAME statement to run binary files.
Syntax
This statement has the following format:
SCRIPTNAME script_name
- script_name
-
Specifies the full path and name of the script to run. It must be a valid executable UNIX file written in a valid scripting language.
Limits: Up to 100 characters; case-sensitive
Notes:
- UNIX systems are case-sensitive. The specified path and script name must match the path and script name on the UNIX system or the job will fail.
- When you use the agent to run a script that calls a second script, you must provide the fully qualified path of the called script.
- The shell can be specified in different places. To run a UNIX script, the agent uses, in the following order, the shell specified in the following places:
- The SHELL statement (if specified in the job definition)
- The first line of the script (if the SHELL statement is not specified)
- The oscomponent.defaultshell parameter in the agentparm.txt file (if not specified in the SHELL statement or in the script)
- The user default shell defined in the user profile (if not specified in one of the previous three locations)
- You must define all shells that you want the agent to use with the oscomponent.validshell parameter in the agentparm.txt file or set the oscomponent.checkvalidshell parameter to false. For more information on the oscomponent.defaultshell and oscomponent.validshell parameters, see the CA Workload Automation Agent for UNIX, Linux, or Windows Implementation Guide.
- The SCRIPTNAME statement usually requires the full path to the script name you want to run. However, you can specify the script name without the full path if all of the following conditions are true:
- The agent is running under the root account.
- The agent is configured to resolve environment variables.
- Using the USER statement, you specify a user ID that has the authority to run the job on the agent computer. The agent uses the user default shell.
- The path to the script name is set in the PATH system environment variable for the specified user ID.
- You can specify the script name using an environment variable, for example, $MY_PATH/myscript.sh, if all of the following conditions are true:
- The agent is running under the root account.
- The agent is configured to resolve environment variables.
- Using the USER statement, you specify a user ID that has the authority to run the job on the agent computer. The agent uses the user default shell.
- The environment variable used, for example $MY_PATH, is set in the specified user ID's profile file.
Example: Run a Script Using the Agent
This example runs the sort script on the UNIX_LA agent. The SHELL statement is unspecified, so the shell is picked up from either the first line of the script, the agentparm.txt file, or the user default shell in the user profile.
AGENT UNIX_LA
SCRIPTNAME /mfg/test/sort
Example: Specify a Shell to Run the Script
This example uses the C shell to run the sort script:
AGENT UNIX_LA
SCRIPTNAME /mfg/test/sort
SHELL /bin/csh
Example: Run a Script that is Located in a Path Set in the PATH System Environment Variable
In this example, an agent named UNIXAGENT runs a script named procscript.sh. The job runs under the user ID jsmith, which has the authority to run the script. The path to procscript.sh is set in the PATH system environment variable for jsmith on the agent computer and the agent is configured to search for paths to command and script files.
AGENT UNIXAGENT
SCRIPTNAME procscript.sh
USER jsmith
Example: Run a Script that is Located in a Path Set in a User Environment Variable
In this example, an agent named UNIXAGENT runs a script named myscript.sh. The job runs under the user ID jsmith, which has the authority to run the script. The path to myscript.sh is set in the user environment variable $MY_PATH, which is defined in the profile file for jsmith, and the agent is configured to search for paths to command and script files.
AGENT UNIXAGENT
SCRIPTNAME $MY_PATH/myscript.sh
USER jsmith
Copyright © 2013 CA Technologies.
All rights reserved.
 
|
|