#!/usr/bin/ksh # # cp_asi_hardrive.ksh # # This script will begin the copy process of # GBO ASI data off of a hardrive. Currently, harddrives # are mounted on sunshine via USB. # # Input arguments $1 = mount path on sunshine # example: /media/transfer # $2 = hard drive name # # The harddrive data will be copied to: # # /disks/themisdata/thg/mirrors/asi/hi_res_copy/staging/cp_from_disk/[hdname] # # Once the copy is complete, the data is moved to: # # /disks/themisdata/thg/mirrors/asi/hi_res_copy/staging/gunzip_review/[hdname] # # Here, the script chk_asi_gunzip.ksh is used to check for # compression errors and move *.gz files to the archive # location. # # creation date: 01-19-07 # . /home/thmsoc/software_dev/config/ground_asi.config . /home/thmsoc/software_dev/config/soc_it_to_me.config ## Set some initial variables # hdpath=$1 hdname=$2 echo ":cp_asi_hardrive::" >> $LOGFILE echo ":cp_asi_hardrive:: Beginning ASI Hardrive Copy for $hdname on $(date)" >> $LOGFILE echo ":cp_asi_hardrive:: Directories copied:" >> $LOGFILE ## List directories to be copied # for fullpath in $(ls -1d ${hdpath}/2*) do year=$(basename $fullpath) for fullpath2 in $(ls -1d ${hdpath}/${year}/*/*) do echo ":cp_asi_hardrive:: $fullpath2" >> $LOGFILE done done ## Begin copy process # printf "%s\n" "Subject: GBO ASI Harddrive Copy Begun" \ "script: $0" \ "Copy begun for $hdname" | mailx -s "THEMIS GBO ASI Harddrive Copy Begun" $SOC_EMAIL mkdir -p ${CP_FROM_DISK}/${hdname} cp -r ${hdpath}/2* ${CP_FROM_DISK}/${hdname} echo ":cp_asi_hardrive::" >> $LOGFILE echo ":cp_asi_hardrive:: ASI Hardrive Copy ends for $hdname on $(date)" >> $LOGFILE printf "%s\n" "Subject: GBO ASI Harddrive Copy Ended" \ "script: $0" \ "Copy ended for $hdname" | mailx -s "THEMIS GBO ASI Harddrive Copy Ended" $SOC_EMAIL ## Now move data into gunzip review directory and start ## procedure # mkdir -p ${GUNZIP_REVIEW}/${hdname} mv -f ${CP_FROM_DISK}/${hdname}/* ${GUNZIP_REVIEW}/${hdname} /home/thmsoc/software_dev/ksh/chk_asi_gunzip.ksh $hdname exit 0