Miscellaneous Procedures > Using the CLI Utility > Execution Modes > Batch Mode

Batch Mode
Batch mode is used when CLI commands are run from a file as described in the following bulleted list:
CLI commands can be saved in a plain text file and executed in batch mode by invoking the CLI utility with the -f file option.
CLI commands can be used in any kind of shell script:
#!/bin/CLI can be invoked at the top of a shell script if the script contains only CLI commands.
Any type of shell can be used to run CLI commands along with other commands.
For a very simple example, you could create a script that calls /bin/CLI to run in batch mode to configure a hostname for the OnSite as shown in the following screen example.
To run a CLI command from the same script that is running other Linux commands, you could put the command in another type of shell script. The bash shell is shown in the following example:.
/bin/CLI -s config network hostsettings hostname FremontCAOnSite
To run multiple CLI commands from a script that is also running other Linux commands, you could add the multiple CLI commands as shown in the following example:.
/bin/CLI << EOF
You could then make the script executable and execute it on the command line, as shown in the following screen example.
[root@OnSite root]# chmod 777 scriptname2
[root@OnSite root]# ./ scriptname2
Alternately, you can put one or more commands in a plain text file without invoking any shell as shown in the following screen example.
After you save and quit the file, you can invoke the CLI command with the
-f file option to execute the command(s) from the file, as shown in the following example.
[root@OnSite root]# CLI -f file

Miscellaneous Procedures > Using the CLI Utility > Execution Modes > Batch Mode