1 | 1 | simandl | #!/bin/sh |
2 | | | # |
3 | | | # skript na synchronizaci CZF4BFU serveru |
4 | | | # |
5 | | | # adresar kam se maj ukladat soubory se zdroji (nejcastejc '/var/www/czf4bfu') |
6 | | | DATADIR='/home/www/html/czf4bfu' |
7 | | | # ip adresa serveru |
8 | | | MYIP='czf4bfu.prosek.czf' |
9 | | | # server s aktualnim seznamem rozcestniku |
10 | | | LIST='www.jklir.net' |
11 | | | # |
12 | | | cd $DATADIR |
13 | | | # stahneme si aktualni servers.list |
14 | | | if wget -T 3 -t 3 -N servers.list http://$LIST/servers.list |
15 | | | then |
16 | | | echo "*** podarilo se ziskat servers.list z $LIST ***" |
17 | | | else |
18 | | | echo "*** servers.list z $LIST nelze stahnout, pracuju se starym seznamem... ***" |
19 | | | fi |
20 | | | for IP in `cat servers.list` |
21 | | | do |
22 | | | if [ $IP != $MYIP ]; |
23 | | | then |
24 | | | if wget -T 3 -t 3 -N http://$IP/czf4bfu/global-$IP.txt |
25 | | | then |
26 | | | echo "*** podarilo se ziskat global-$IP.txt z $IP ***" |
27 | | | else |
28 | | | echo "*** zkousim jine servery na global-$IP.txt... *** " |
29 | | | PRESKOC=0 |
30 | | | for SERVER in `cat servers.list` |
31 | | | do |
32 | | | if [ $SERVER != $MYIP ]; |
33 | | | then |
34 | | | if [ $PRESKOC -lt 1 ]; |
35 | | | then |
36 | | | if wget -T 3 -t 3 -N http://$SERVER/czf4bfu/global-$IP.txt |
37 | | | then |
38 | | | echo "*** podarilo se ziskat global-$IP.txt z $SERVER ***" |
39 | | | PRESKOC=1 |
40 | | | fi |
41 | | | fi |
42 | | | fi |
43 | | | done |
44 | | | fi |
45 | | | fi |
46 | | | done |