Using Log Files and Batch Files

From GEAR Software Knowledgebase

Revision as of 23:30, 13 May 2006 by Jcopp (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This chapter provides you with information about creating and using batch files. You can read about the following:

Creating and editing a log file Running a GEAR batch file Creating and Editing a Log GEAR 's batch utility lets you run multiple GEAR commands automatically--without ongoing interaction from you. The easiest way to create a batch file is to use the Generate Log command in the File menu to create the image once. This is particularly useful for incremental backups or if you have to create the same image periodically with updated files, a CD that is updated quarterly, for example.

As you create the image, the commands you use are saved in a log file. You can use this log file as a reference to create batch files, or sometimes you can edit the log file and use it as a batch file. You can also read the log file to check the image generation process.

Generating a Log File Choose Generate Log from the File menu to display the Name of logfile dialog. Enter a name for the log file or choose one under File Name. Choose a location to save the file, then click Create. If you select the option Show log in the Window menu, you will notice that Logging started is displayed in the Status window.

Perform the actions you want to save in the log file. Each action you perform is recorded in the Status window. When you are finished, un-check Generate Log from the File menu. Logging stopped is displayed in the Status window. Editing a Log File You can use a text editor such as emacs or vi to look at the log file. All lines that are preceded by a semicolon are comment lines--these lines are ignored when you run the batch file.

If you add comments to the log file, remember to start the line with a semicolon (;). You can also add any GEAR formatting commands to the batch file (these commands correspond to the GEAR for Windows commands available in the menus).

Running a Batch File When you run a batch file, each command in the file is executed. You can use a log file you create using the Generate Log command in the file menu or you can use a log file you create manually in a text editor.

When you run a batch file, lines that begin with a semicolon or an unknown command will be ignored. If there are lines that have invalid or missing parameters, GEAR prompts you to provide the parameter.

Choose Run Batch from the File menu to display the Name of batch file dialog. Locate and choose the log or batch file you want to use, then click Open. GEAR prompts you to run the batch automatically using the default dialog values. Click Yes. As the batch file is processed, its status is displayed in the Status window.

Running a batch as a startup-option To run a batch file automatically when you start GEAR, you must run the following command:

GEARCLI /A /X

(where stands for the path and filename of the batch file, /A enables the automated mode and /X exits GEAR after completion of the batch.

Please note that the batch file needs to be initiated from the GEAR software directory, because the program relies on several files in that directory. Failing to do so will result in errors.

Running a GEAR command You can execute GEAR commands from the File menu using "File/Run GEAR Command". Whenever you execute a command and you have the log view/window enabled (if supported, see Window menu), you will see the result on the screen and/or log window.

Go here for more batch file information: General Commands.

Personal tools
wiki navigation