#!/bin/bash -e rsyncargs="-avz --partial" onedb=0 special=0 args=`getopt pnqd: $*` if [ $? != 0 ] ; then echo "USAGE: doDownloads.sh [-p] [-n] [-q] [-d ]" echo -e "\t-d: process only . If not specified, all dbs listed in the file 'databases' are processed. The arguments 'gbdb', 'html', 'hgFixed', 'proteinDB', 'uniProt' are treated as special cases." echo -e "\t-p: show progress" echo -e "\t-n: dry run" echo -e "\t-q: quiet" exit 1 fi set -- $args for i do case "$i" in -p) rsyncargs="$rsyncargs --progress" shift;; -n) rsyncargs="$rsyncargs -n" shift;; -q) rsyncargs="$rsyncargs -q" shift;; -d) if [[ $2 == "html" || $2 == "gbdb" || $2 == "hgFixed" || $2 == "proteinDB" || $2 == "uniProt" ]] ; then special=$2 else DBS=$2 fi onedb=1 shift shift;; --) shift break;; esac done if [ $onedb != 1 ] ; then DBS=`grep -v '^#' /usr/data/mirror-download/databases` fi if [ $special == 0 ] ; then for db in $DBS ; do echo "Rsyncing database $db..." mkdir -p /usr/data/mirror-download/$db/database if [ $db == "cb1" ] ; then #special case src=cbJul2002 else src=$db fi rsync $rsyncargs --delete --max-delete=20 rsync://hgdownload.cse.ucsc.edu/genome/goldenPath/$src/database/ /usr/data/mirror-download/$db/database/ done fi # gbdb if [[ $onedb == 0 || $special == "gbdb" ]] ; then echo "Rsyncing gbdb..." rsync $rsyncargs --exclude-from=/usr/data/mirror-download/gbdb.exclude rsync://hgdownload.cse.ucsc.edu/gbdb/ /gbdb/ # FIXME: somehow need to handle deletions, but can't delete local data fi # html if [[ $onedb == 0 || $special == "html" ]] ; then echo "Rsyncing html..." rsync $rsyncargs rsync://hgdownload.cse.ucsc.edu/htdocs/ /var/www/html-browser/ fi # hgFixed if [[ $onedb == 0 || $special == "hgFixed" ]] ; then echo "Rsyncing hgFixed..." mkdir -p /usr/data/mirror-download/hgFixed rsync $rsyncargs --delete --max-delete=20 rsync://hgdownload.cse.ucsc.edu/genome/goldenPath/hgFixed/ /usr/data/mirror-download/hgFixed/ fi # proteinDB if [[ $onedb == 0 || $special == "proteinDB" ]] ; then echo "Rsyncing proteinDB..." mkdir -p /usr/data/mirror-download/proteinDB rsync $rsyncargs --delete --max-delete=20 rsync://hgdownload.cse.ucsc.edu/genome/goldenPath/proteinDB/ /usr/data/mirror-download/proteinDB/ fi # uniProt if [[ $onedb == 0 || $special == "uniProt" ]] ; then echo "Rsyncing uniProt..." mkdir -p /usr/data/mirror-download/uniProt rsync $rsyncargs --delete --max-delete=20 rsync://hgdownload.cse.ucsc.edu/genome/goldenPath/uniProt/ /usr/data/mirror-download/uniProt/ fi # FIXME: need better solution for this #wget http://hgdownload.cse.ucsc.edu/admin/hgcentral.sql echo "Done."