Starting in batch mode

You can start the command-line interface in batch mode.

About this task

You run the shell script (pure.bat on Windows and pure on Linux) from the pure.cli/bin directory on your local computer. In this procedure you start in batch mode, specifying the host name or IP address for the system, along with an authorized user ID and password to start a user session, and several additional arguments required for batch mode operation.

Procedure

  1. On your local computer, navigate to the pure.cli/bin directory, where you installed the command-line interface tool (example on Windows: C:\Download\PureAS\pure.cli-2.0.0.0\pure.cli.
  2. In the local command prompt window, from the \bin directory, run the shell script, specifying the (pure.bat on Windows and pure on Linux) script name, along with the following arguments:
    -h <host_or_IP>
    Specifies the host name or the IP address of the system. If you specify this option, do not use the URL to access the web interface. If this parameter is not specified, the command-line interface uses the value of the host_name environment variable to determine the host name.
    -u <userID>
    Specifies the user ID that you use to authenticate to the system. Use the same user identifier that you use to log in to the console.
    -p <password>
    Specifies the password that is used to authenticate to the system. Use the same password that you use to log in to the console. You are not required to specify a password to access the help for the command-line interface.
    -a
    Automatically accepts the certificates from the system. You can also format the parameter as --acceptcert.
    -i
    Ignore version comparison. If you connect to a system with a lower version than the CLI version, an unsupported error version occurs. Use this option to ignore version comparison. You can also format the parameter as --ignoreversion.
    -c <command>
    Passes a command to the command line to be run. You can specify this option multiple times to run multiple commands. If the command is a Python expression, it is evaluated and the command-line interface displays the result. If the command is a Python statement, it is run but no output is generated unless the statement itself causes output to be generated.
    -f <script_file> <arg>*
    Results in the command line running the specified Python script file with the specified arguments. Any arguments following the script file name are passed to the Python script. Only one -f parameter can be specified on the command line.

    Usage examples:

    pure -h 172.16.98.225 -u user01 -p password01 --acceptcert -c deployer.patterns
    pure -h 172.16.98.225 -u user01 -p password01 --acceptcert -f /SOAPolicyLoader/pureCLI/pure.cli/samples/exportPattern.py --downloadAll -t /SOAPolicyLoader/export
    On Linux, you can make the shell automatically use the command-line interface tool to run your Python scripts. If the pure.cli/bin directory is on your PATH, insert the following line at the top of your script to have the shell execute it using the command-line interface:
    #!/usr/bin/env pure

    The same Python scripting language is supported when you pass commands to the command line by using any of these methods, the -c parameter, or a script file specified using the -f parameter.

    To pass the command-line interface password in a file, run the savePassword utility, located in the pure.cli/bin directory. Run the command as shown in the following example:
    savePassword <fileName> <password>
    Note: Do not include any path or directory information in the command. The password file is saved to the folder that corresponds to %APPDATA% on computers running Windows operating systems, or to the directory that corresponds to $HOME on computers running Linux or UNIX operating systems.
    Use the --passfile argument when you are invoking the command-line interface and want to use a password file instead of explicitly specifying a password in the invocation command, similar to the following example:
    pure.bat -h 172.16.98.225 -u admin --passfile <filename> -a

What to do next

For additional help on commands, attributes, or methods on the command-line interface, see the Related tasks. A set of sample scripts that demonstrate some of the command-line interface functions is available in the pure.cli/samples directory.