jablonka.czprosek.czf

czf4bfu

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

 

Line No. Rev Author Line
11unreal#!/bin/sh
2#
3# skript na synchronizaci CZF4BFU serveru
4# by Unreal][
521unreal# verze 1.9
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'
1121unreal### LIST - server s aktualnim seznamem rozcestniku
12LIST='http://www.jklir.net/servers.list'
1315unreal 
14###########################################################################################
15 
161unrealcd $DATADIR
17# stahneme si aktualni servers.list
1821unrealif wget -T 3 -t 3 -N $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
3221unreal if wget -T 2 -t 2 -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
4220unreal then
43 echo "***** podarilo se ziskat global-$IP.txt z $SERVER *****"
44 PRESKOC=1
4521unreal fi
46 fi
47 done
4820unreal fi
4921unreal fi
5015unreal fi
51done
52 
53### zkontrolujeme, jestli neni nejaky global navic
54 
55GLOBALS=`ls global-*.txt | sed 's/^global-//' | sed 's/\.txt$//'`
56for TMPSVR in $GLOBALS
57do
58 OBSAHUJE=$(cat servers.list | grep $TMPSVR | wc -l)
59 if [ $OBSAHUJE != "0" ]
60 then
61 echo "*** $TMPSVR OK ***"
62 else
63 if [ $TMPSVR != $MYIP ]; then
64 mv ./global-$TMPSVR.txt ./global-$TMPSVR.txt.bckp
65 echo "*** $TMPSVR NEnalezen v servers.list a byl zalohovan ***"
66 fi
67 fi
68done
6916unreal### mrkneme se po externich ikonkach
70 
71OLD_IFS=$IFS; IFS=$'\n'
72GLOBALS=`ls global-*.txt | sed 's/^global-//' | sed 's/\.txt$//'`
73for TMPSVR in $GLOBALS
74do
75 for ICONS in `grep 'ICON:' global-$TMPSVR.txt`; do
76 ICONURL=`echo "$ICONS" | sed -n "s/^ICON: \([[:space:]]+\)\?\([^[:space:]#].*\)/\2/p"`
77 ICONNAME=`echo "$ICONURL" | sed -n "s/^\(.*\)\/\([^[\/].*\)$/\2/p"`
7821unreal if [ "$ICONNAME" != "" ] && [ ! -f "$DATADIR"/"$TMPSVR"_"$ICONNAME" ]; then
7918unreal if wget -T 3 -t 3 -N -U CZF4BFU $ICONURL
8016unreal then
8118unreal mv $ICONNAME $DATADIR/cache/"$TMPSVR"_"$ICONNAME"
8216unreal echo "***** podarilo se stahnout ikonku $ICONNAME ze serveru $TMPSVR *****"
83 else
84 PRESKOC=0
85 for SERVER in `cat servers.list`
86 do
8721unreal if [ $SERVER != $MYIP ] && [ $PRESKOC -lt 1 ]; then
88 if wget -T 3 -t 3 -N -U CZF4BFU http://$SERVER/czf4bfu/cache/"$TMPSVR"_"$ICONNAME"
8916unreal then
9021unreal mv "$TMPSVR"_"$ICONNAME" $DATADIR/cache/"$TMPSVR"_"$ICONNAME"
9116unreal echo "***** podarilo se stahnout ikonku $ICONNAME ze serveru $SERVER *****"
92 PRESKOC=1
9321unreal else
94 if wget -T 2 -t 2 -N -U CZF4BFU http://$SERVER/cache/"$TMPSVR"_"$ICONNAME"
9520unreal then
9621unreal mv "$TMPSVR"_"$ICONNAME" $DATADIR/cache/"$TMPSVR"_"$ICONNAME"
9720unreal echo "***** podarilo se stahnout ikonku $ICONNAME ze serveru $SERVER *****"
98 PRESKOC=1
9921unreal fi
10016unreal fi
101 fi
102 done
103 fi
104 fi
105 done
106done
107IFS=$OLD_IFS

Powered by WebSVN 2.2.1