The CMDNAME statement specifies a command to run on a Windows or UNIX computer.
Supported Job Types
This statement is required for the Windows job type.
To run binary files on UNIX, 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:
CMDNAME command_file
Specifies the full path and name of the command to run. It must be a legal executable Windows file name or a valid binary UNIX file name.
Limits: Up to 512 characters; case-sensitive
Notes:
UNIX Notes:
Windows Notes:
CMDNAME c:\winnt\system32\ipconfig.exe
CMDNAME c:\winnt\system32\cmd.exe ARGS /c "dir c:\temp\"
C:\Program files\esp\espcmd1.bat C:\Program files\esp\espcmd2.bat C:\payroll\data\pay.exe
cd C:\Program files\esp espcmd1.bat espcmd2.bat cd C:\payroll\data pay.exe
If your batch file takes input and output information, use the cd command to switch to the directory where the input and output files reside. In this example, file ftptest.bat reads the ftp command from the file ftpscript.src. The batch file outputs to file ftp.out in the current working directory.
cd d:\temp\script ftp -n -i -s:ftpscript.src 131.50.30.28 >ftp.out user guest verbose lcd d:\temp\data cd /u1/guest get data1 quit
If you run ftptest.bat from the command line, manually switch to the d:\temp\script directory before running the file. The Windows operating system knows the current working directory, so you do not need to include the cd d:\temp\script command in the batch file.
If you run ftptest.bat using the agent, however, the agent does not know the working directory. Specify the cd d:\temp\script command in the batch file, or the ftp command will fail.
Example: Identify a Command to Run Within a Job
In this example, sort is the name of the command and c:\payroll\test is the path.
CMDNAME c:\payroll\test\sort
Example: Run a Visual Basic Script
In this example, the agent invokes the Visual Basic interpreter wscript.exe using the CMDNAME statement and passes the Visual Basic script notify.vbs as a parameter using the ARGS statement:
AGENT NT_NY CMDNAME c:\winnt\system32\wscript.exe ARGS c:\programs\vbs\notify.vbs
Example: Run a UNIX Command
This example runs the report command under the user1 user ID on agent UNIX_NY:
AGENT UNIX_NY CMDNAME /mfg/report USER user1
Example: Redirect I/O and Pipe Output
This example redirects I/O and pipes output from a command. The agent runs the UNIX command ps -ef|grep cybAgent and pipes output to the /tmp/log file. The shell interpreter is invoked in the CMDNAME statement and the command is included in the ARGS statement.
AGENT SUN30RD CMDNAME /usr/bin/ksh ARGS -c "ps -ef|grep cybAgent >>/tmp/log" USER user1
Example: Specify a Script Name Without the Full Path
In this example, an agent named WINAGENT runs a script named procscript.bat. The path to procscript.bat is set in the system path on the agent computer and the agent is configured to search for paths to command and script files.
AGENT WINAGENT CMDNAME procscript.bat
|
Copyright © 2013 CA Technologies.
All rights reserved.
|
|