How To Create UNIX Exclude List

Modification:
 
An exclude_list file can be created for a specific client, policy or schedule.  The exclude_list file must be created by the administrator in the /usr/openv/netbackup directory on UNIX clients.

The following options exist when creating an exclude_list file:
- Create an exclude_list file if the exclude list will apply to all backups of the client.
- Create an exclude_list.<policy> if the exclude list will apply only for a specific policy.
- Create an exclude_list.<policy>.<schedule> if the exclude list will apply to only one schedule in a policy.

NetBackup will use only read the exclude_list file that most closely matches the backup policy and schedule being performed. The <policy> and <schedule> used in the file name must be an exact match to the policy and schedule defined on the master server.

The following examples are meant to show different methods to format an exclude_list on a NetBackup client.  It is important to note that exclude list entries need to follow UNIX rules and conventions. 

 
How to properly exclude a file name by the extension:
 
The following is a valid way to handle file names by extension: 
   *.log 
   *_log
 
This will properly exclude all files and directory names that end in .log or _log. The asterisk character is needed to do the wildcard expansion.
  
The incorrect way to exclude by extension is to use: 
   .log 
   _log  
 
This will only match specific file or directory names for .log or _log. Without the asterisk character, there is no wildcard expansion done to match files ending in these entries.
 
How to properly exclude a filename that contains a specific string:
 
The following is a valid way to handle filenames that contain a specific string: 
   *.log.* 
   *_log_* 

This will match any file or directory name that contains .log. or _log_. The period or underscore has no specific meaning in this example. The asterisk does the wildcard expansion. 
 
How to properly exclude a specific filename or directory:
 
The following is a valid way to handle specific file or directory names. 
   log 
   logs

This will match any file or directory names called log or logs.  In this case, no asterisk is needed since there isn't any matching to be done.
 
How to use the ? character in an exclude_list entry:
 
A valid way to use the ? character in an exclude_list entry would be: 
   log.??????

This would exclude any file that begins with log. and follows with six characters. This would matchlog.021804 but not match log. since log. must be followed by six characters. The ? is used as a wildcard for any single character in a file or directory name. Each question mark is used to match a single character.
 
How to use the [] characters in an exclude_list entry:

      EXAMPLE 1: A valid way to use the [] characters in an exclude_list entry would be:
         log[12345]
 

This would exclude the files log1log2log3log4log5 but would not match log or log12345. The characters inside the [] are used to match any single character that is contained between the [].
 
 
     EXAMPLE 2: Suppose path "/path" contains several subdirectories, u01, u02, u03, u04, u10, u12, u13, u14.

     If you only want to back up /path/u01, the following exclude entry would *not* work, and all subdirectories would be backed up:
             /path/u[02-14]  

     To exclude every subdirectory except u01, two lines would be needed in the exclude_list, using the following syntax:
            /path/u0[2-4]
            /path/u1[0-4]

    An easy way to confirm before the backup whether the syntax is correct is to use an "ls" command. For the above incorrect syntax, "ls" would reveal that the syntax is incorrect:
           ls /path/u[02-14]
           No Match.

How to exclude a file or directory that contains a special character:
    A valid way to exclude files that contain special characters in the name would be:
 

\*logfile\*

This would match the file named *logfile* but would not match logfile or any filename that containslogfile. The backslash character will de-reference any of the special characters used in a NetBackup exclude_list.  
 
 
These special characters are: 
asterisk * 
comment # 
square brackets  [ ] 
backslash \ 
question mark ?