#!/bin/sh #efficiently upload logs from a list of ESP moorings #~ftp must be seeded with directories corresponding #to each ESP host from which upload. Each of these hostname #directories in turn should initially contain an empty directory #corresponing to each remote user whose log data is to be uploaded #parameters are the hostnames from which to upload #if none specified, default to ~ftp/ESP/station/* . `dirname $0`/uploading.sh #: ${upload_domain:=.endofinternet.org} domain=$upload_domain : ${upload_top:=`echo ~ftp/ESP/station`} cd $upload_top || exit 3 : ${upload_opts:="-t 3 --retr-symlinks --passive-ftp"} : ${upload_hosts:=${@:-*}} : ${wget:="wget -nv"} #/usr/local/bin for ftpdir in $upload_hosts; do host=`basename $ftpdir` echo "Uploading from $host..." cd $upload_top/$ftpdir || exit 2 uploading=$PWD/.UPLOADING.pid claim $uploading for topfile in *; do if [ -d "$topfile" ]; then cd $topfile && $wget -N -r -nH --cut-dirs=1 -c $upload_opts "ftp://$host$domain/$topfile/*"||continue 2 cd $upload_top/$ftpdir || exit 2 else wget -N -c $upload_opts "ftp://$host$domain/$topfile" || continue 2 fi done release $uploading echo "*** $upload_hosts Synchronized ***" done