jablonka.czprosek.czf

czf4bfu

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

 

Line No. Rev Author Line
11unreal#!/bin/sh
2#
3# skript na synchronizaci CZF4BFU serveru
4# by Unreal][
520unreal# verze 1.8
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
3220unreal if wget -T 3 -t 3 -N -U CZF4BFU http://$IP/global-$IP.txt
33 then
34 echo "*** podarilo se ziskat global-$IP.txt z $IP ***"
35 else
36 echo "*** zkousim jine servery na global-$IP.txt... *** "
37 PRESKOC=0
38 for SERVER in `cat servers.list`
39 do
40 if [ $SERVER != $MYIP ] && [ $PRESKOC -lt 1 ]; then
41 if wget -T 3 -t 3 -N -U CZF4BFU http://$SERVER/czf4bfu/global-$IP.txt
42 then
43 echo "***** podarilo se ziskat global-$IP.txt z $SERVER *****"
44 PRESKOC=1
45 else
46 if wget -T 3 -t 3 -N -U CZF4BFU http://$SERVER/global-$IP.txt
47 then
48 echo "***** podarilo se ziskat global-$IP.txt z $SERVER *****"
49 PRESKOC=1
50 fi
51 fi
52 fi
53 done
54 fi
5515unreal fi
56 fi
57done
58 
59### zkontrolujeme, jestli neni nejaky global navic
60 
61GLOBALS=`ls global-*.txt | sed 's/^global-//' | sed 's/\.txt$//'`
62for TMPSVR in $GLOBALS
63do
64 OBSAHUJE=$(cat servers.list | grep $TMPSVR | wc -l)
65 if [ $OBSAHUJE != "0" ]
66 then
67 echo "*** $TMPSVR OK ***"
68 else
69 if [ $TMPSVR != $MYIP ]; then
70 mv ./global-$TMPSVR.txt ./global-$TMPSVR.txt.bckp
71 echo "*** $TMPSVR NEnalezen v servers.list a byl zalohovan ***"
72 fi
73 fi
74done
7516unreal### mrkneme se po externich ikonkach
76 
77OLD_IFS=$IFS; IFS=$'\n'
78GLOBALS=`ls global-*.txt | sed 's/^global-//' | sed 's/\.txt$//'`
79for TMPSVR in $GLOBALS
80do
81 for ICONS in `grep 'ICON:' global-$TMPSVR.txt`; do
82 ICONURL=`echo "$ICONS" | sed -n "s/^ICON: \([[:space:]]+\)\?\([^[:space:]#].*\)/\2/p"`
83 ICONNAME=`echo "$ICONURL" | sed -n "s/^\(.*\)\/\([^[\/].*\)$/\2/p"`
84 if [ "$ICONNAME" != "" ]; then
8518unreal if wget -T 3 -t 3 -N -U CZF4BFU $ICONURL
8616unreal then
8718unreal mv $ICONNAME $DATADIR/cache/"$TMPSVR"_"$ICONNAME"
8816unreal echo "***** podarilo se stahnout ikonku $ICONNAME ze serveru $TMPSVR *****"
89 else
90 PRESKOC=0
91 for SERVER in `cat servers.list`
92 do
93 if [ $PRESKOC -lt 1 ]; then
9418unreal if wget -T 3 -t 3 -N -U CZF4BFU http://$SERVER/czf4bfu/cache/"$SERVER"_"$ICONNAME"
9516unreal then
9618unreal mv "$SERVER"_"$ICONNAME" $DATADIR/cache/"$SERVER"_"$ICONNAME"
9716unreal echo "***** podarilo se stahnout ikonku $ICONNAME ze serveru $SERVER *****"
98 PRESKOC=1
9920unreal else
100 if wget -T 3 -t 3 -N -U CZF4BFU http://$SERVER/cache/"$SERVER"_"$ICONNAME"
101 then
102 mv "$SERVER"_"$ICONNAME" $DATADIR/cache/"$SERVER"_"$ICONNAME"
103 echo "***** podarilo se stahnout ikonku $ICONNAME ze serveru $SERVER *****"
104 PRESKOC=1
105 fi
10616unreal fi
107 fi
108 done
109 fi
110 fi
111 done
112done
113IFS=$OLD_IFS

Powered by WebSVN 2.2.1