Loading...

Save as Script Overview

You can save CommCell operations as scripts that can be run from the command line or incorporated into other scripts. The Save as Script option generates two files on the selected client computer:

Batch or Shell File

The .bat (Windows) and .sh (UNIX) files contain the following commands:

  • qlogin - to log on to the session
  • qoperation execute - to execute the XML file

    Important: Edit the .bat file to include the complete path to your XML file if either of the following apply:

    • The XML file is not located in the software_installation_directory/Base folder
    • You schedule your .bat file as a task in the Windows Task Scheduler
  • qlogout - to logout from the session

The batch file can be executed in two modes:

  • Asynchronous, where the operation is submitted to the CommServe and the return control is given to the calling program or script.
  • Synchronous, where the command line operation exits only after the operation is complete.

XML File

The .xml file contains the options selected from the CommCell Console. This .xml file is the input for the qoperation execute command defined in the batch file. When running the batch file in the command prompt, you can change the XML parameters. These parameters are passed into the generated XML file when the batch file runs. Use the following format:

myscript.bat -parameter value

The .xml file can be used from the command line without the batch file. Use the qoperation execute command and pass in the .xml file as an argument file. Use the following format:

qoperation execute -af backup_template.xml

Considerations

  • The script can be run on the CommServe or on any other client computer. If you move the script, you must move both the script and input files to the client computer from which the script will be executed.
  • A script generated by the Save As Script option is supported when the CommServe version is same as the client version. You can not generate scripts when the CommServe has a higher version than the client.
  • Certain characters (for example, the left bracket [ and number sign #) in front of an object name (for example, #csmacs as the subclient name) may cause the script to not work correctly when it is run from the command line. If your script does not work from the command line, check it for these characters. Remove the characters, and then rerun your script.
  • You can save the job options as a script in a local folder on a client machine by entering user credentials and providing the destination path to the client machine.

Example

Use the following steps to save the data aging operation as a script:

  1. From the CommCell Browser, right-click the CommServe node, point to All Tasks and then click Data Aging.
  2. From the Data Aging Options dialog box, select the data aging options.
  3. Click Save As Script to open the Save As Script dialog box.
  4. In the Client box, click the client computer where the script will be saved.
  5. In the File Path box, enter the location where the script will be saved.

    Alternatively, you can click Browse and navigate to the location.

  6. Add the file name and extension to the location. For example, "C:\scripts\myscript.bat" for Windows or "/usr/scripts/myscript.sh" for UNIX.

    If .xml and .bat/.sh files with the same name already exist, they cannot be overwritten unless the bAllowSaveAsScriptFileOverWrite additional setting is used. For information on adding bAllowSaveAsScriptFileOverWrite, see Enabling File Overwrite.

  7. In the Specify User Account to Run the Script box, click the user whose credentials will be used to run the script.

    For information on these options, see Command Line Online Help: Save As Script.

  8. Click OK.

Last modified: 3/12/2018 6:46:02 PM