#!/bin/bash # $ GPL2 by yjmenezes at gmail.com versao 1.0 2012-02-18 $ # baixa arquivos, diretorios e subdiretorios filtrando # ativa o downloade na hora marcada. extra: desliga a maquina ao terminar. # TODO fix extra permission if [ $# -lt 3 ] then clear 1>&2 echo `basename $0` "url_fonte dir_destino_cp MMDDhhmm [-s shutdown] " 1>&2 echo `basename $0` "http://gpl2.com.br/gnu_scripts /tmp/gscr 02181750 -s" 1>&2 exit 1 fi cd /tmp/ mkdir -p $2 cd $2 echo $1 $2 $3 1>&2 # -nH Disable generation of host-prefixed directories. # --no-parent Do not ever ascend to the parent directory # --cut-dirs=2 JOB=`echo 'wget -r -nH --cut-dirs=2 --no-parent --reject="index.html*"' $1 ` echo $JOB | at -t $3 sleep 1 if [ $# -gt 3 ] then SHUT=`echo $3 | awk '{ printf "%08d", $1 + 1 }'` echo $SHUT JOB=`echo shutdown -h now` echo $JOB | at -t $SHUT echo $JOB "as" $SHUT 1>&2 fi echo "programed jobs:" 1>&2 atq 1>&2 exit 0