jablonka.czprosek.czf

czf4bfu

Subversion Repositories:
[/] [czf4bfu.sh] - Blame information for rev 18

 

Line No. Rev Author Line
11unreal#!/bin/sh
2#
3# skript na synchronizaci CZF4BFU serveru
4# by Unreal][
518unreal# verze 1.7
61unreal#
715unreal### DATADIR - adresar kam se maj ukladat soubory se zdroji (nejcasteji '/var/www/czf4bfu')
81unrealDATADIR='/var/www/www.kobylisy.czf/czf4bfu'
915unreal### MYIP - ip adresa nebo DNS zaznam serveru
101unrealMYIP='czf4bfu.kobylisy.czf'
1115unreal### LIST - server s aktualnim seznamem rozcestniku (bez http://) ... /servers.list
121unrealLIST='www.jklir.net'
1315unreal 
14###########################################################################################
15 
161unrealcd $DATADIR
17# stahneme si aktualni servers.list
1814unrealif wget -T 3 -t 3 -N http://$LIST/servers.list
191unrealthen
20 echo "*** podarilo se ziskat servers.list z $LIST ***"
21else
22 echo "*** servers.list z $LIST nelze stahnout, pracuju se starym seznamem... ***"
23fi
24 
2515unrealfor IP in `cat servers.list`
26do
27 if [ $IP != $MYIP ]; then
28 if wget -T 3 -t 3 -N -U CZF4BFU http://$IP/czf4bfu/global-$IP.txt
29 then
30 echo "*** podarilo se ziskat global-$IP.txt z $IP ***"
31 else
32 echo "*** zkousim jine servery na global-$IP.txt... *** "
33 PRESKOC=0
34 for SERVER in `cat servers.list`
35 do
36 if [ $SERVER != $MYIP ] && [ $PRESKOC -lt 1 ]; then
37 if wget -T 3 -t 3 -N -U CZF4BFU http://$SERVER/czf4bfu/global-$IP.txt
38 then
39 echo "***** podarilo se ziskat global-$IP.txt z $SERVER *****"
40 PRESKOC=1
41 fi
42 fi
43 done
44 fi
45 fi
46done
47 
48### zkontrolujeme, jestli neni nejaky global navic
49 
50GLOBALS=`ls global-*.txt | sed 's/^global-//' | sed 's/\.txt$//'`
51for TMPSVR in $GLOBALS
52do
53 OBSAHUJE=$(cat servers.list | grep $TMPSVR | wc -l)
54 if [ $OBSAHUJE != "0" ]
55 then
56 echo "*** $TMPSVR OK ***"
57 else
58 if [ $TMPSVR != $MYIP ]; then
59 mv ./global-$TMPSVR.txt ./global-$TMPSVR.txt.bckp
60 echo "*** $TMPSVR NEnalezen v servers.list a byl zalohovan ***"
61 fi
62 fi
63done
6416unreal### mrkneme se po externich ikonkach
65 
66OLD_IFS=$IFS; IFS=$'\n'
67GLOBALS=`ls global-*.txt | sed 's/^global-//' | sed 's/\.txt$//'`
68for TMPSVR in $GLOBALS
69do
70 for ICONS in `grep 'ICON:' global-$TMPSVR.txt`; do
71 ICONURL=`echo "$ICONS" | sed -n "s/^ICON: \([[:space:]]+\)\?\([^[:space:]#].*\)/\2/p"`
72 ICONNAME=`echo "$ICONURL" | sed -n "s/^\(.*\)\/\([^[\/].*\)$/\2/p"`
73 if [ "$ICONNAME" != "" ]; then
7418unreal if wget -T 3 -t 3 -N -U CZF4BFU $ICONURL
7516unreal then
7618unreal mv $ICONNAME $DATADIR/cache/"$TMPSVR"_"$ICONNAME"
7716unreal echo "***** podarilo se stahnout ikonku $ICONNAME ze serveru $TMPSVR *****"
78 else
79 PRESKOC=0
80 for SERVER in `cat servers.list`
81 do
82 if [ $PRESKOC -lt 1 ]; then
8318unreal if wget -T 3 -t 3 -N -U CZF4BFU http://$SERVER/czf4bfu/cache/"$SERVER"_"$ICONNAME"
8416unreal then
8518unreal mv "$SERVER"_"$ICONNAME" $DATADIR/cache/"$SERVER"_"$ICONNAME"
8616unreal echo "***** podarilo se stahnout ikonku $ICONNAME ze serveru $SERVER *****"
87 PRESKOC=1
88 fi
89 fi
90 done
91 fi
92 fi
93 done
94done
95IFS=$OLD_IFS

Powered by WebSVN 2.2.1