Jogger.pl


Oryginalny komentarz

Ale sieczka :( Może się uda drugie podejście, choć pewne elementy i tu mogą coś popsuć.

@ #!/bin/bash

#Czas krytyczny
ct=6;
hct=$(( $ct / 2 ));

#Licznik zakończeń
endmax=20;
endcnt=0;

url=http://podbij.pl/auction/; #au=270-kino-domowe-lg-ht552ph

if [ $# -lt 1 ] ; then echo „Usage: $0 aukcja”; exit 1;
else au=$1;
fi;

while [ $endcnt -le $endmax ] ; do [ -e $au ] && rm $au; wget -q ${url}${au}; if [ -e $au ] ; then t=$( grep „class=\„time\”„ $au | sed ‘s-.class=„time”>\(.\)</div>\1;s-:-: -g’ | awk ‘{if ($1 ! „:”) print 3600*$1+60*$2+$3; }’ ); end=$( grep „class=\„time msg\”„ $au | sed ‘s-.class=„time msg”>\(.\)</div>\1‘ ); p=$( grep „class=\„price\”„ $au | sed ‘s-.class=„price”>\(.\)</span></td>\1‘ | awk ‘{if ($0 ~ „,”) print $0}’); if [ -z $end ] ; then if [ $t -ge $ct ] ; then # dużo czasu echo `date`” Czas: „$t” Cena: „$p; sleep $(( $t – $ct + 1 )); else # mało czasu tr=$(( $( date +%s ) + $t )); [ $t -le $hct ] && c=31 || c=33; echo -e $au” \e[1;${c}mKoniec: „$( date -d ’1970-01-01 ‘$tr’ sec’ +”%Y-%m-%d %T %z” )”\e[0m Czas: „$t” Cena: „$p; usleep 400000; fi; else # koniec, ale może odżyje endcnt=$(( $endcnt + 1 )); echo -e $au” \e[1;32m${end}\e[0m (${endcnt}) Data: „`date`” Cena: „$p; sleep $ct; fi; else # błąd echo -e `date`” \e[1;36mCannot find $au\e[0m”; usleep 600000; fi;
done
@

Zmodyfikowany komentarz

Ale sieczka :( Może się uda drugie podejście, choć pewne elementy i tu mogą coś popsuć.

@ #!/bin/bash

#Czas krytyczny
ct=6;
hct=$(( $ct / 2 ));

#Licznik zakończeń
endmax=20;
endcnt=0;

url=http://podbij.pl/auction/; #au=270-kino-domowe-lg-ht552ph

if [ $# -lt 1 ] ; then echo „Usage: $0 aukcja”; exit 1;
else au=$1;
fi;

while [ $endcnt -le $endmax ] ; do [ -e $au ] && rm $au; wget -q ${url}${au}; if [ -e $au ] ; then t=$( grep „class=\„time\”„ $au | sed ‘s-.*class=„time”>\(.*\)</div>-\1-;s-:-: -g’ | awk ‘{if ($1 ! „:”) print 3600*$1+60*$2+$3; }’ ); end=$( grep „class=\„time msg\”„ $au | sed ‘s-.*class=„time msg”>\(.*\)</div>-\1-‘ ); p=$( grep „class=\„price\”„ $au | sed ‘s-.*class=„price”>\(.*\)</span></td>-\1-‘ | awk ‘{if ($0 ~ „,”) print $0}’); if [ -z $end ] ; then if [ $t -ge $ct ] ; then # dużo czasu echo `date`” Czas: „$t” Cena: „$p; sleep $(( $t – $ct + 1 )); else # mało czasu tr=$(( $( date +%s ) + $t )); [ $t -le $hct ] && c=31 || c=33; echo -e $au” \e[1;${c}mKoniec: „$( date -d ’1970-01-01 ‘$tr’ sec’ +”%Y-%m-%d %T %z” )”\e[0m Czas: „$t” Cena: „$p; usleep 400000; fi; else # koniec, ale może odżyje endcnt=$(( $endcnt + 1 )); echo -e $au” \e[1;32m${end}\e[0m (${endcnt}) Data: „`date`” Cena: „$p; sleep $ct; fi; else # błąd echo -e `date`” \e[1;36mCannot find $au\e[0m”; usleep 600000; fi;
done
@