#!/bin/sh # # $Id: //depot/isms/skulker/cbd/1.1/bin/live-cbd#6 $ # # file: live-cbd # desc: automate processing of live CBD feed # # make sure this is available for the Tcl scripts we call... IW=${IW:-/iw} ; export IW # make sure CBD processing scripts are in PATH PATH="${IW}/skulker/cbd/current/bin:${PATH}" # abort function abort() { echo "Nothing to do ... aborting." /bin/rm -f $lockfile exit 0 } # live CBD root directory liveroot='/data/cbd/live' cd $liveroot/staging # create processing lockfile if it doesn't exist lockfile='live-cbd.lock' [ -f $lockfile ] && exit 0 /bin/touch $lockfile # list of XML files to mix livefiles="`pwd`/files.live.$$" # mirror live CBD data from GPO server echo "Mirroring live CBD files ..." /iw/mirror/current/mirror.pl -pcbd \ /iw/mirror/current/packages/vax1ftp.access.gpo.gov > .mirror.log 2>&1 # any files to process? exit if not [ -z "`grep '\.CBD ' .mirror.log`" ] && abort # get list of files to process for f in `/bin/grep '^Got ' .mirror.log | /bin/awk '{print $2}'` do # get local copy for processing /bin/cp -p ../../raw/${f} . done # generate proper XML version of cbdsgml.dtd submissions echo "Converting to XML ..." cbd2xml *.CBD # generate temporary cbdspace.dtd format XML and install in xml directory tree echo "Generating CBDspace XML ..." cbd2dtd *.xml > ${livefiles} # mix new cbdspace into edgarspace blocks echo "Generating CBDspace blocks ..." /bin/cat ${livefiles} | (cd /iw/space/current/mixer ; etc/big.tcl bulk doc.cbd) # clean up raw src files echo "Cleaning up ..." /bin/rm -f *.CBD /bin/rm -f *.DTD /bin/rm -f *.nc /bin/rm -f *.xml /bin/rm -f ${livefiles} # remove lock file /bin/rm -f $lockfile echo "Done." exit 0