mocksetup: /unsafe+/hdd -> /quad
[nethome.git] / bin / centrum.sh
1 #! /bin/sh
2 #max of max is 999!
3 max=310
4 umask 077
5 exec &>~/priv/centrum.log
6 cd ~
7 rm -rf ~/centrum
8 mkdir ~/centrum
9 cd ~/centrum
10 i=1
11 last=
12 while [ $i -le $max ];do
13   j="`echo -n 000$i|tail -c 3`"
14   echo -n "$j: `date` - "
15   lynx -auth short:`cat ~/priv/centrum.pwd` -reload -source 'http://hazard.centrum.cz/~short~eb3c8f5deb72db253053b59290c804d9/hry/bandita_code.phtml' >$j.html
16   date
17   now="`sed -n 's/^.*Kredity.*VALUE="\([0-9]*\)".*$/\1/p' <$j.html`"
18   if [ "$now" = "$last" ];then break;fi
19   last="$now"
20   sleep 17
21   i=$[$i+1]
22   done
23 echo -n "Termination: "
24 if [ $i -gt $max ];then echo "max $max credits exceeded."
25 else echo "Count "$last" matched on file $j.html."
26 fi
27 echo "Current credits: $last"
28 tar cf - *|bzip2 -v >~/priv/centrum.tar.bz2
29 cd ~
30 rm -rf ~/centrum