The Text File policy is used to make changes to any text file on a device.
To configure the Text File policy:
In the ZENworks Control Center, click the
tab.In the Policies list, click
, then click to display the Create New Policy page.In the Policy Type list, click
, then click to display the Policy Name page.Fill in the fields:
Policy name: (Required) Provide a unique name for the policy. The name you provide displays in the ZENworks Control Center interface, which is the administrative tool for ZENworks Linux Management.
For more information, see Section C.0, Naming Conventions in the ZENworks Control Center.
Folder: (Required) Type the name or browse to the folder that this policy will be created in. Folders display in the ZENworks Control Center.
Description: Provide a short description of the policy. This description displays on the policy's Summary page in the ZENworks Control Center interface.
Click
to display the General page.Select the desired options:
Filename: Specify the name and the complete path of a file you want to change.
Maximum number of versions to retain: Specify the maximum number of backups to be maintained for a file that has been changed. If the maximum limit of backups is reached, the oldest backup of a file is deleted. The backup is created in the same location as the specified file.
Change name: Specify the name of the change you want to perform in the file. If you want to make more than one change in the same file, go to the Settings page.
Change mode: Select an option from the drop-down list:
Search file: Lets you search for the given text in the entire file. Fill in the fields:
Search string: Specify the text you want to search for in a given file. The search string can be simple text or a regular expression. For detailed information on regular expressions, click the button.
Case sensitive: Select this option to distinguish between uppercase and lowercase characters. When
is selected, the system finds only those instances in which the capitalization matches the text you have specified in the search string.Search occurrence: Indicates the occurrence of the search text you have given. The available options are
, , and . For example, if you select , the system finds the first occurrence of the search string and performs the specified action on it.Result action: Select the operation from the drop-down list that you want perform on the specified search text.
Append lines to file: Lets you append the given lines of text to the file
Prepend lines to file: Lets you prepend the given lines of text to the file.
New string: Specify the text to be used for carrying out the specified action in the file. For example, you can select to replace a search string with a new string.
Create the file, if it does not exist: Allows you to create the specified file, if it does not exist. The file is created with the specified contents.
Contents of the file: Allows you to add contents to the specified file. This option is available only if you select the
option. The file is created with owner and group set to root and r w - r - - r - - (644) permission. If any directory specified in the absolute file path does not exist, then it is created with owner and group set to root and r w x r - x r- x (755) permission. You can modify the ownership and permissions by configuring a script in the Post Change Action pane. (The Post Change Action pane is located in the Script page. To access the Script page, click in the General Page user interface.)Apply the change details: Applies the settings configured in the Change Details pane. By default, this option is selected when you select the
option.Click
to display the Script Page.Fill in the fields:
Pre-change action: Specify the actions to perform before modifying the text files:
Executable type: Select the executable type from the drop-down list that you want to run before modifying the file. The available options are
, , , and .(Conditional) If you chose
in the field, the following options are available:Script to run: Select an option from the drop-down list (
or ):Specify a file: Fill in the fields:
Script filename: Specify the complete path, including the filename, of the script you want to run on a managed device.
Script parameters: Specify any parameters to be passed to the specified script file.
Script engine: Specify the name and location of the script engine that runs the script. For example, /usr/bin/perl.
Script engine parameters: Specify any parameters to be passed to the specified script engine.
Define your own script: Type your script in the box.
(Conditional) If you chose Binary in the
field, the following options are available:Executable file name: Specify the complete path, including the filename, of the binary program you want to run on a managed device.
Executable file parameters: Specify any parameters to be passed to the specified binary program.
(Conditional) If you chose
in the field, the following options are available:Java program name: Specify the Java program you want to run on a managed device.
Program parameters: Specify any parameters to be passed to the specified Java program.
Java Runtime Executable (JRE): Specify the complete path, including the Java Runtime Executable (JRE) name. JRE is used to interpret the Java binary file.
JRE parameters: Specify the parameters to be passed to the Java Runtime Executable (JRE).
NOTE:The /bin/sh is used, which is a default value.
specified in the Remote Execute policy is executed in the shell specified by the environment variable SHELL. The value of the variable SHELL is taken from the environment in which ZENworks Management daemon runs. If a value is not specified, thenAction when the execution fails: Select an action you want the system to perform when an execution fails. You can continue modifying the file by selecting
or you can stop the modifications in the file by selecting .NOTE:The backup of the text file is taken after the pre-change action completes the execution and before the text file modification starts.
Post-change action: Specify the actions to perform after the actual changes are done in the file.
Executable type: Select the executable type you want to run after modifying the file. Select Binary, Java, Script, or None from the drop-down list. Depending on which type you select, the available options vary. For more information about the specific options, see the descriptions in the Pre-Change Action section directly above.
Click
to display the Summary page.Click Section 17.4, Assigning Policies.
to create the policy as configured according to the settings on the Summary page. If you click , the Text File policy is created but it does not have devices assigned or a schedule specified. At some point in the future, you need to configure additional options for the policy by continuing withor
Click
to display the Policy Assignment page to perform the following tasks:Specify assignments for this policy
Specify the schedule for this policy
Specify groups for this policy
Assign the policy to the devices.
Click
to browse for and select the appropriate Server or Workstation objects.You can also select Folder or Group objects.
Click the down-arrow next to
or to expand the list, then click the underlined link in the column to select the desired objects and display their names in the list box.Assigning a policy to a Group object is the preferred method of assigning the policy. Assigning the policy to a large number of objects (for example, more than 250) might cause increased server utilization.
Click
.Click
to display the Policy Schedule page, then select the schedule to apply to the assignments.The settings you configure on this page determine when the policy is applied to devices.
See Section 15.3, Schedules for information about the available schedules.
Click
to display the Policy Groups page.(Optional) Click
to open the Select Groups dialog box, then click the underlined links in the column to select the desired policy groups and display their names in the list box.Using policy groups eases administration efforts by letting you group several policies so you can use common assignments, schedules, and so forth, rather than configuring these settings for each policy you create. For more information, see Section 17.3, Creating Policy Groups.
Click
to display the Finish page.Review the information on the Finish page, making any changes to the policy settings by using the
button as necessary. Click to create the policy as configured according to the settings on the Finish page.