X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=get.sh;h=e5b394dffbc0269b96686ed1c5f045b420fb5ee3;hb=4e1986293b6f8ff1893dad78013b1d93dd346f64;hp=a0d03f809344ade833b8c2ada9fb6018fc2fc42e;hpb=866830d1411d8f82315c4450e4f576b9c6e42daa;p=aoc2021.git diff --git a/get.sh b/get.sh index a0d03f8..e5b394d 100755 --- a/get.sh +++ b/get.sh @@ -4,6 +4,23 @@ DAY=`date +%e|sed 's/ //g'` FILE="$((2*DAY - 1))in.txt" COOKIE=`cat cookie` +START="6:00:02" +MAXWAIT=300 +STARTSEC=`date -d "$START" "+%s"` +NOW=`date "+%s"` +WAITSEC=`expr $STARTSEC - $NOW` + +if [ $WAITSEC -gt 0 -a $WAITSEC -lt $MAXWAIT ] +then + echo "Waiting for $WAITSEC seconds till $START ..." + sleep $WAITSEC +fi + URL="https://adventofcode.com/2021/day/$DAY/input" -echo "Stahuji $URL do $FILE" -curl -q -b "$COOKIE" "$URL" --output "$FILE" +echo +echo "Downloading $URL to $FILE" +curl -s -b "$COOKIE" "$URL" --output "$FILE" +echo +echo "lines words chars" +wc "$FILE" +echo