move2silo and corresponding scripts (by Mike Johnson) ===================================================== Sergey Boyarinov, Feb 2006 1. General scheme ----------------- bosOpen(libbosio) -> checkdisk -> checkraid -> dumpstat.short -> doublecheck x -> redalert x -> alert x -> active -> oflcpy x -> empty -> graboldest x -> preinsert x -> graboldest x -> move2silo -> postinsert x -> enumoldest x -> graboldest x -> clonput2 -------> -> move2silo -> preinsert x -> empty -> graboldest 2. Description -------------- Following directories and symbolic links must be created before starting: active -> /mnt/raidX: directory contains current data from the Event Recorder empty -> .mnt/raidX: directory is to be used by the ER after the active directory fills presilo1 -> /mnt/raidX: directory, if exists, contains data to be spooled over to tape silo postsilo1 -> /mnt/raidX: directory, if it exists, contains data most recently saved to tape silo postsilo2 -> /mnt/raidX: directory contains data which has been streamed to tape silo STUB.TARGET: file contains the name of the directory to hold stub files for data for the current experiment; Stub files are later used during data retrieval example: /mss/clas/eg4a/data logfile: log messages from various scripts environment: for example: set PAWNS = " `cat /ssa/PAWNS` " set PARTITIONS = " raid0 raid1 raid2 raid3 " set LOGFILE = "/ssa/logfile" ????????????????????????????? KING: for example: clon10 PAWNS: for example: clon00 clon01 clon02 clon03 clon04 clon05 clon06 ????????????????????????????? checkdisk: first script to be called by bosOpen(); just calls 'checkraid' using 'sudo' checkraid: the only parameter is how much space (MBytes) may remain on disk; script checks the '/ssa/active' area to see if there is enough room for another file; if there is not enough room, the partitions are juggled to make room and processes are spawned to move data to silo later; If there is enought room, the script simply exits + dumpstat.short: return partitions list as following: raid0 ACTIVE raid1 EMPTY raid2 EMPTY raid3 EMPTY possible status: ACTIVE EMPTY MOVING FULL '(BACKED UP)' FULL '(NOT BACKED UP)' empty: if '/ssa/empty' does not exist, grabs oldest 'postsilo' and makes it empty; checks again if '/ssa/empty' exists and cleans it up; then if '/ssa/active' does not exist mv 'empty' to 'active' + graboldest: return file name with biggest number, for example if '/ssa/postsilo1' and '/ssa/postsilo2' are exists, then 'graboldest postsilo' will return '/ssa/postsilo2' active: do following actions: - mv '/ssa/active' to '/ssa/presilo' - call 'oflcpy' - calls 'empty' - calls 'redalert' if '/ssa/active' did not shows up after 'empty' - calls 'empty' again to clean another partition if needed - calls 'preinsert presilo' + alert: dummy right now; suppose to send warnings redalert: sends error message clonput2: calls Computer Center script; our responsibility ends here + doublecheck: checks to see if all files in ARG[1] have matching, nonzero stubs in the dir indicated in '/ssa/STUB.TARGET'; for example command doublecheck raid1 `cat /ssa/STUB.TARGET` will check if all files from raid1 were successfully transfered to SILO directory specified in '/ssa/STUB.TARGET' + enumoldest: returns the number of 'oldest' file in '/ssa' with specified name; for example if 'postsilo1' and 'postsilo2' files are in '/ssa' directory then command 'enumoldest postsilo' will return 2 move2silo: main work is done here; oflcpy: copies all files '/ssa/presilo/stage_in/clas_[0-9]*.A00' into work disk + postinsert: move file X -> XN, where N is maximum existing N + 1; for example if we have 3 files 'postsilo', 'postsilo1' and 'postsilo2' then command 'postinsert postsilo' will rename 'postsilo' to 'postsilo3' + preinsert: rotate group of files X->X1, X1->X2, ...; for example if we have 3 files 'postsilo', 'postsilo1' and 'postsilo2' then command 'preinsert postsilo' will move files as following: postsilo -> postsilo1 postsilo1 -> postsilo2 postsilo2 -> postsilo3