The DBNet clean routine uses the file table/cleanlist as input
to determine what directories and what files to delete. The cleanlist indicates the sort
order and quantity of file to delete. The queue handler will run the dbn_clean program
at regular intervals, as defined in the dbn_config table. The dbn_clean program reads
the cleanlist table from disk each time it runs. The cleanlist is processed one line at
a time from the top down. Comments start with the # character. Dbn_clean builds a list
of all the files that match the criteria specified in the cleanlist, sorts that list and
then deletes the files at the end of the list until the list is the correct length. There
are currently 14 sort orders that can be used by dbn_clean. The most basic sort order is
the time stamp of the file. The remaining sort orders use perl regular expression to
determine a sort key. The list is then sorted alphabetically based on that key.
The following is an example cleanlist:
/usr/DBNet/log dbnet\.log\.\d{6} 0 4
/usr/DBNet/log IFS\.log\.\d{6} 0 4
/usr/DBNet/err .* 0 100
/usr/DBNet/data WMO.* 0 1000
/usr/DBNet/data BUFR.* 0 1000
/usr/DBNet/data ALERT.* 0 1000
/usr/DBNet/data falert.* 0 100
/usr/DBNet/data X224.* 0 500
/usr/DBNet/data nesdis.* 0 100
/usr/DBNet/data FALERT.* 0 100
/dcom/us007003 \d{6} 1 6
/tmp tranjb\.\d+ 0 100
/pcom/pcom/test/status/log WWTOSOS\..* 0 50
/pcom/pcom/test/status/log WWGTOSO\..* 0 50
/pcom/foreign/text .* 0 100
# the following entries cleanup /dcom on less than ten days info
# these lines include the recurse subdirs field as 1
/dcom/us007003 \d{6}/b012/xx001 0 2 1
/dcom/us007003 \d{6}/b012/xx002 0 3 1
/dcom/us007003 \d{6}/b012/xx005 0 3 1
/dcom/us007003 \d{6}/b012/xx008 0 3 1
/dcom/us007003 \d{6}/b012/xx009 0 3 1
/dcom/us007003 \d{6}/b012/xx010 0 3 1
/dcom/us007003 \d{6}/b012/xx011 0 3 1
/dcom/us007003 \d{6}/b003/xx101 0 3 1
/dcom/us007003 \d{6}/wgrbbul$ 1 3 1
The following is the format of the cleanlist:
- Directory The starting directory for the file search
- Filename pattern A perl regular expression for the files within the search
directory that we are interested in
- Sort Order The sort order as defined in table 2
- Keep The number of files to keep
- Recurse An optional flag indicating directory recursion. 1 = yes 0 or
not present = no recursion
The cleanlist may contain comments.
Comment lines MUST begin with a # (pound sign), all other lines will be
compared to the perl regular expression:
\S+[ \t]+\S+[ \t]+\S+[ \t]+\S+\s*\S*"
The matching lines will have four or five fields, the fifth being optional.
The fields are white space separated and defined below.
The following are the sort orders:
- '"";',
- '$_ =~ /(${pattern_YYMMDD})/, "$1";',
- '$_ =~ /(${pattern_YYMMDD})${pattern_F}(${pattern_HH})/, "$1$2";',
- '$_ =~ /(${pattern_YYMMDD})${pattern_F}(${pattern_HH})${pattern_F}(${pattern_MI})/, "$1$2$3";',
- '$_ =~ /(${pattern_YYMMDD})${pattern_F}(${pattern_HH})${pattern_F}(${pattern_MI})${pattern_F}(${pattern_SS})/, "$1$2$3$4";',
- '$_ =~ /(${pattern_MMDD})/, "$1";',
- '$_ =~ /(${pattern_MMDDHH})/, "$1";',
- '$_ =~ /(${pattern_MMDDHHMI})/, "$1";',
- '$_ =~ /(${pattern_MMDDHHMISS})/, "$1";',
- '$_ =~ /(${pattern_DDHH})/, "$1";',
- '$_ =~ /(${pattern_DDHHMI})/, "$1";',
- '$_ =~ /(${pattern_DDHHMISS})/, "$1";',
- '$_ =~ /(${pattern_HHMI})/, "$1";',
- '$_ =~ /(${pattern_HHMISS})/, "$1";',
- '$_ =~ /(${pattern_YYYYMMDD})/, "$1";',