• Antelope Release 5.8 Linux CentOS release 7.4.1708 (Core) 3.10.0 2018-04-25

 

NAME

rtdbclean - real-time database and disk cleaner

SYNOPSIS

rtdbclean [-n] [-t] [-w] [-x] [-C] [-c channel_subset] [-v] [-V] [-m mail_to] [-p parameter_file] [orb] rt_db

DESCRIPTION

rtdbclean removes old waveforms and their respective wfdisc rows from an operational real time database rt_db. rtdbclean also removes bogus data which has time more than two days in the future. The original rtdbclean program required that the orb be specified in the command line. A change in the orb2db and orb2dbt processes through the use of the orb2db_msg have eliminated the requirement for the orb to be specified. It is still allowed as an optional argument to maintain backward use compatability. The orb argument is ignored in the program.

Initially removes only waveforms and then runs the command orb2db_msg rt_db pause, directing processes writing to the database to pause, then performs the following operations:

When the complete, rtdbclean runs the command orb2db_msg $rt_db continue, signaling processes which write to the database to continue, and sends an email to the specified mail list in the parameter file notifying if there was an abnormal completion.

OPTIONS

ENVIRONMENT

needs to be called from rtexec or have sourced /opt/antelope/setup.csh. Need environment variable $PFPATH to be set.

PARAMETER FILE

rtdbclean parameter file elements are:

EXAMPLE PARAMETER FILE


#
# Remove wfdisc records and data according to either free disk space or
# maximum days in database (whichever is more restrictive)

min_disk_free           1000  # minimum free megabytes on disk
max_days_db               30  # maximum days of wfdisc waveforms
max_days_clean_tables      7  # maximum number of days of data
                              #   left in additional cleaned tables

# Remove any anomalously empty wfdisc records after some period

min_days_clean_wfdisc     1   # minimum number of days to wait before
                              #   removing wfdisc rows with  nsamp==0
                              #   or abs(endtime-time-(nsamp-1)/samprate)>.0005

# orb2db_msg wait for the message file to be cleared

orb2db_msg_sleep_secs  10  # how long (in seconds)
orb2db_msg_timeout_secs  900  # how long (in seconds)

#
# Remove older records from certain other database tables

clean_tables &Tbl{            # clean up these tables in addition
    detection                 #    to wfdisc
    gap
    retransmit
    trigger
}

#
# Check to see if tables exist

check_tables &Tbl{
    wfdisc
    arrival
    assoc
    origin
    event
    origerr
    netmag
    stamag
    calibration
    sitechan
    sensor
}

#
# Unique rows

unique_primary &Tbl{
    assoc
    changed
    dlevent
    emodel
    netmag
    origerr
    origin
    predarr
    stamag
}

#
# Nojoin table cleanup

nojoins &Arr{           # remove rows from first table which do not join with second table
   assoc_arrival  &Tbl{
        assoc
        arrival
    }
	assoc_origin  &Tbl{
        assoc
        origin
    }
	predarr_arrival &Tbl{
        predarr
        arrival
    }
	origin_event  &Tbl{
        origin
        event
    }
#       Beware!  origin nojoin with assoc will remove "lost" origins that may have
#       been created by the chop (keep/delete/reassoc/chop) button in dbloc2. If
#       you wish to keep these events, please comment out the next 4 lines.
	origin_assoc  &Tbl{
        origin
        assoc
    }
	emodel_origin  &Tbl{
        emodel
        origin
    }
	event_origin  &Tbl{
        event
        origin
    }
	origerr_origin  &Tbl{
        origerr
        origin
    }
	netmag_origin  &Tbl{
        netmag
        origin
    }
	stamag_origin  &Tbl{
        stamag
        origin
    }
	stamag_netmag  &Tbl{
        stamag
        netmag
    }
}

DIAGNOSTICS

rtdbclean is normally run as a cron job under rtexec, so the errors will be written to the log directory. All messages are sent to STDERR.

SEE ALSO

dbfixchanids(1), dbjoin(1), dbselect(1), dbsort(1), dbsubset(1), orb2db_msg(1), pf(3), pfecho(1), rtexec(1)

BUGS AND CAVEATS

rtdbclean will check to see if a file named .rtdbclean exists and is locked. If .rtdbclean is locked then rtdbclean will not execute. This is to avoid protential situations which can either corrupt the rt_db database or corrupt a running process. Other programs which can lock .rtdbclean are mk_dmc_seed, dmc_nrtwf, rtbackup, event_archive.

AUTHOR

Frank Vernon
Boulder Real Time Technologies, Inc.
Printer icon