jablonka.czprosek.czf

czf4bfu

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

 

Line No. Rev Author Line
11unreal#!/bin/sh
2#
3# skript na synchronizaci CZF4BFU serveru
4# by Unreal][
515unreal# verze 1.6
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 
65### mrkneme se po externich ikonkach
66 
67OLD_IFS=$IFS; IFS=$'\n'
68GLOBALS=`ls global-*.txt | sed 's/^global-//' | sed 's/\.txt$//'`
69for TMPSVR in $GLOBALS
70do
71 for ICONS in `grep 'ICON:' global-$TMPSVR.txt`; do
72 ICONURL=`echo "$ICONS" | sed -n "s/^ICON: \([[:space:]]+\)\?\([^[:space:]#].*\)/\2/p"`
73 ICONNAME=`echo "$ICONURL" | sed -n "s/^\(.*\)\/\([^[\/].*\)$/\2/p"`
74 if [ "$ICONNAME" != "" ]; then
75 if wget -T 3 -t 3 -N -U CZF4BFU $ICONURL -O $DATADIR/cache/"$TMPSVR"_"$ICONNAME"
76 then
77 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
83 if wget -T 3 -t 3 -N -U CZF4BFU http://$SERVER/czf4bfu/cache/"$SERVER"_"$ICONNAME" -O $DATADIR/cache/"$SERVER"_"$ICONNAME"
84 then
85 echo "***** podarilo se stahnout ikonku $ICONNAME ze serveru $SERVER *****"
86 PRESKOC=1
87 fi
88 fi
89 done
90 fi
91 fi
92 done
93done
94IFS=$OLD_IFS

Powered by WebSVN 2.2.1