Proceed as follows:-
DBMauto distributes updates only, so you need to have a database that is already primed with existing tables. Unless you your database is up to date, see Database Priming
Subdirectories of this will be used for local scripts, configuration files, log files etc. A suggested convention is to use:-
$MINOS_SOFT/dbm
but any empty directory with read/write access will do. For the remainder
of these instructions this directory will be called dbm_top_dir.
mkdir dbm_top_dir
This is done by going to the directory and then running the DBMauto launcher script, supplying the --prime option as an argument:-
cd dbm_top_dir $SRT_PUBLIC_CONTEXT/DatabaseMaintenance/scripts/primer/launch.csh --prime (sh/bash shell users: use launch.sh instead)Notes:-
If everything is O.K., you will output similar to the following :-
Creating /home/west/work/minos/temp/work... Creating /home/west/work/minos/temp/scripts... Populating the scripts subdirectory... Creating local.config... Creating run_import.sh... Creating run_checksum.sh... Populating the work subdirectory... Creating FNAL_import.context... Creating FNAL_import.log... Priming completeIf you run a second time you will get:-
Populating the scripts subdirectory... File local.config already exists; please move it away to recreate it File run_import.sh already exists; please move it away to recreate it File run_checksum.sh already exists; please move it away to recreate it Populating the work subdirectory... File FNAL_import.context already exists; please move it away to recreate it File FNAL_import.log already exists; please move it away to recreate it Priming completeshowing that the system only recreates missing files.
This priming process creates the following structure:-
scripts/
local.config
run_import.sh
run_checksum.sh
work/
FNAL_import.context
FNAL_import.log
The scripts directory contains a file holding the local
configuration and two scripts that should be set up as cron jobs.
The work directory contains a log file that records imports and
a context file used to determine what update to take next.
set switch valueto:-
switch=value
export switch
( on bash you can abbreviate this to:
export switch=value )
$SRT_PUBLIC_CONTEXT/DatabaseMaintenance/scripts/logentry_mail_list
and commit it, or get someone who has the privileges to do it
for you.
If you are not used to crontab, then a quick primer:-
crontab -lList any entries you already have in your cron table.
crontab -eRuns the default editor so that you can create and modify cron table entries.
Important
The first time you run run_import.sh it will take a long time
as it will have to process a large backlog of update files.
It may not even complete, for example, linux sometimes kills jobs
if it gets short of resources. The system is designed to be failsafe
so repeat the job and check on
FNAL_import.log
until you see that it is waiting for updates. Only then should you
set it up as a cron job, for otherwise there is a risk that a second
cron job will start up before the first has completed.
As an alternative you might consider adding executables to the /etc/cron.hourly, /etc/cron.daily and /etc/cron.weekly directories, which get executed at the frequency their name suggests. For example the file:-
/etc/cron.hourly/dbm_import.croncould contain the file:-
/minos/software/OO/dbm/scripts/run_import.sh 2>&1 > /var/log/dbm_import_latest.log
If you maintain a Master site then you will need to run run_export.sh instead of, or as well as, run_import.sh.
ImportantYou must run Slave sites imports at least weekly, and fix problems promptly. If you let it get more than 2 weeks out of date then it may fail with "Unable to process update files .. - there is a gap after update..."
There is a recommendation on the scheduling of cron jobs. If the job involves access to AFS disks under KERBEROS control see Using KERBEROS.
If you don't get a report daily, or the report does not say that there have been at least a few successful imports then something is wrong. Depending on other jobs on the local machine, some jobs may fail and send error reports. For example if you have a regular build running each night, then DBMauto may fail simply because the dbmjob has been deleted. So long as these are isolated incidents, and you continue to get good daily reports, such errors can be ignored.
setenv DBM_DEBUG ./run_import.shto see if something is wrong and then examine FNAL_import.log to see if that gives any clues. If there are errors only a summary is placed in the log file but it will contain the name of a error log file that contains the full job output which should also be examined.
cd $SRT_PUBLIC_CONTEXT/DatabaseTables/ cvs update
cd CalibrationTables/ mysql --local-infile=1 -u writer -p ... use offline \. create_and_fill_calibration.mysql quit cd.. cd UgliTables/ mysql --local-infile=1 -u writer -p ... use offline \. define_and_fill_ugli.mysql quit cd.. cd PlexTables/ mysql --local-infile=1 -u writer -p ... use offline \. define_and_fill_plex.mysql quit cd..
mysql -u writer -p ... use offline delete from PLEXVETOSHIELDMUXTOMDL where seqno = 200000401; delete from PLEXVETOSHIELDMUXTOMDLVLD where seqno = 200000401; delete from UGLIDBISCINTMDL where seqno between 210004528 and 210004575; delete from UGLIDBISCINTMDLVLD where seqno between 210004528 and 210004575; delete from UGLIDBISCINTPLN where seqno between 210004528 and 210004575; delete from UGLIDBISCINTPLNVLD where seqno between 210004528 and 210004575; delete from UGLIDBISTEELPLN where seqno between 210004528 and 210004575; delete from UGLIDBISTEELPLNVLD where seqno between 210004528 and 210004575; delete from UGLIDBISTRIP where seqno between 210004528 and 210004575; delete from UGLIDBISTRIPVLD where seqno between 210004528 and 210004575; quit
Nick will compare it against the database at FNAL, and if there are problems may send back a Checksum Analysis report
Filters apply to each table and select the range of SEQNOs to be included. The filter:-
For each table the best (i.e. longest) match filter is taken, so in the above example CAL*, PLEX* and UGLI* are matched in full, DBUSUBRUNSUMMARY is matched for 2xxxxxxxx SEQNOs and everything else is ignored.
| Type | Description |
|---|---|
| Cksm | Wrong checksum |
| Date | Wrong Creation Date |
| Ins | Bad Insert Date |
| Miss | Missing |
| Type | Description |
|---|---|
| Conflicts | Conflicts of some type (Cksm,Date, Ins, Miss) |
| O.K. | O.K. |
| Part ign | No conflict but record ignored at some sites. |
| All ign: | Record ignored at all sites. |