Setting Up the Server Policy PackageThe Text File Changes Policy

Setting Up the Server Policy Package The Text File Changes Policy

This policy is a plural policy, which means that you can create multiple instances of this policy in a single policy package. You create this policy by clicking the Add button at the bottom of the main Server Policy Package screen. When you click the Add button, you are prompted to select a policy and to name the policy. You need to select Text File Changes for the policy and enter a unique policy name. After you do this, you can activate and modify the policy. Figure 5.27 displays a sample Text File Changes policy.

Figure 5.27. Text File Policy page of the text file changes policy in a Server Policy Package.

graphics/05fig27.jpg

This policy enables you to specify a set of text changes that you want done on ASCII text files on your server.

You enter a requested text file change by clicking the Add button. After clicking the Add button, you are prompted to identify the name of the text file and the name of the change script. You can have multiple change scripts for each file you identify. Make sure you enter the complete filename (including path) for the name of the text file to change. The changes are applied to the specified file in the order shown. Should you wish to change the order of the changes or the order of the files, select the item and move it in the list by clicking the up or down arrows.

The first setting you should make is to choose the change mode that corresponds to this change policy. You may choose either Prepend to File, Append to File, or Search File as one of your modes.

Prepend to File

When you choose to prepend text to the file, the right side of the Administration page changes to display a large text box. You may enter any text strings that you want in the text box. Click OK to store this entry. When the policy is applied, the exact strings that you typed are placed as the first lines in the file.

Append to File

When you choose to append text to the file, the right side of the Administration page changes to display a large text box. You may enter any text strings that you want in the text box. Click OK to store this entry. When the policy is applied, the exact strings that you typed are placed as the last lines in the file.

Search File

Should this change be a Search File change, you need to administer the following additional information to make the change effective:

  1. Identify the search type that you need for this change. The search type may be Sub-String, Whole Word, Start of Line, End of Line, or Entire Line. The following describes the meaning of each of these search types.

    • Sub-String. Search for the search string in any of the text. The text specified may be contained anywhere in the file, even in the middle of a word. If you have the substring of day, for example, the following text would all match with this substring: today, day, yesterday, daytime, and so forth.

    • Whole Word. Search for the string such that it is surrounded by white space or is at the beginning or end of a line. If you have the string of day, for example, only the word day would be a match. The words today, yesterday, daytime, and so forth do not constitute a match.

    • Start of Line. This is a successful match if the beginning of a line (first line of file, or characters following a carriage return) starts with the string, regardless of whether the string is a whole word or not. To continue the example, if you had the string day, this type would match only with the following lines: daytime is set, day by day, and so forth.

    • End of Line. This is a successful match if the end of a line (characters preceding the carriage return or end of file) contains the string, regardless of whether the string is a whole word or not. With the example, if you had the string day, this type would match only with the following lines: the time to act is today, day by day, and so forth.

    • Entire Line. The entire specified string must consume the entire line of text (from text following a carriage return, or beginning of the file, to the next carriage return, or end of the file), including any white space. It must be an exact match of every character, other than the carriage returns, on the line. If your string were day, only a line with the single word day in it would match.

  2. Specify the search string that you're trying to match. Enter this into the Search String field.

  3. Identify whether you want the search to be case-sensitive by selecting the check box to make the search identify a match only if the case matches.

  4. Change the Find All Occurrences field if you want to find only the first occurrence of the string in the file. The default is to have this field checked, meaning that all occurrences in the file have this policy applied to them.

  5. Choose a result action that is applied to the string after it is located in the file. The possible actions are Delete All Lines After, Delete All Lines Before, Prepend to File If Not Found, Append to File If Not Found, Replace String, Replace Word, Replace Line, and Append Line. The following describes each of these choices and their resulting actions:

    • Delete All Lines After. All lines (characters following the next carriage return) are deleted from the file. The file is basically truncated, ending with the line that held the first matching string. Obviously, searching for all occurrences is not effectual when this is the resulting action, because a match truncates the rest of the file.

    • Delete All Lines Before. All lines (characters before and including the previous carriage return) are deleted from the file. The file is reset such that it begins with the line that held the first matching string. With this result action, another search continues and if another match is found, all the lines before it are deleted as well.

    • Prepend to File If Not Found. This action places the replacement text in the file at the very beginning of the file should the search string not be found in the file. This action only adds text; it does not delete or modify text.

    • Append to File If Not Found. This action places the replacement text at the end of the file should the specified search string not be found. This action only adds text; it does not delete or modify text.

    • Replace String. This action takes the matching string and removes it from the file, placing the replacement string in the exact location of the deleted string. If the replacement string is of a different length than the search string, the surrounding characters are shifted to the left or right depending on whether less or more room is required. Basically, the new text is inserted in the location where the search string was removed.

    • Replace Word. This action takes the word where a substring was matched and replaces the whole word (from space or beginning of line to space or end of line) with the replacement text. If the substring were day, for example, the following words would be replaced with the replacement text: day, today, daytime, and so forth.

    • Replace Line. This action takes the line where the match has occurred and removes the complete line from the file. The replacement text is placed in the same location where the removed line was located in the file.

    • Append Line. This action appends the replacement string to the line that contained the match. The matching string is not removed from the file; the only change is the addition of text to the end of the line.

  6. Specify the new string. In the text box that is provided, you need to supply the text that will be applied to the file, based on the action that was specified.

Policy Schedule Page

On this page, you can specify the time frame when you want the system to apply this policy. The details concerning your choices for the schedule are described in the "Setting Up the Server Policy Package The SNMP Community Strings" section earlier in the chapter.



Novell's ZENworks for Servers 3. Administrator's Handbook
Novell's ZENworks for Servers 3. Administrator's Handbook
ISBN: 789729865
EAN: N/A
Year: 2003
Pages: 137

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net