czf4bfu.prosek.czf |
Subversion Repositories: |
Rev 1 | Rev 4 | |
---|---|---|
Line 2... | Line 2... | |
# |
# | |
# skript na synchronizaci CZF4BFU serveru |
# skript na synchronizaci CZF4BFU serveru | |
# verze 1.3 | ||
# |
# | |
# adresar kam se maj ukladat soubory se zdroji (nejcastejc '/var/www/czf4bfu') |
# adresar kam se maj ukladat soubory se zdroji (nejcastejc '/var/www/czf4bfu') | |
DATADIR='/home/www/html/czf4bfu' |
DATADIR='/var/www/www.kobylisy.czf/czf4bfu' | |
# ip adresa serveru |
# ip adresa serveru | |
MYIP='czf4bfu.prosek.czf' |
MYIP='czf4bfu.kobylisy.czf' | |
# server s aktualnim seznamem rozcestniku |
# server s aktualnim seznamem rozcestniku | |
LIST='www.jklir.net' |
LIST='www.jklir.net' | |
# |
# | |
cd $DATADIR |
cd $DATADIR | |
# stahneme si aktualni servers.list |
# stahneme si aktualni servers.list | |
Line 19... | Line 20... | |
fi |
fi | |
for IP in `cat servers.list` |
for IP in `cat servers.list` | |
do |
do | |
if [ $IP != $MYIP ]; |
if [ $IP != $MYIP ]; | |
then |
then | |
if wget -T 3 -t 3 -N http://$IP/czf4bfu/global-$IP.txt |
if wget -T 3 -t 3 -N --user-agent='CZF4BFU' http://$IP/czf4bfu/global-$IP.txt | |
then |
then | |
echo "*** podarilo se ziskat global-$IP.txt z $IP ***" |
echo "*** podarilo se ziskat global-$IP.txt z $IP ***" | |
else |
else | |
echo "*** zkousim jine servery na global-$IP.txt... *** " |
echo "*** zkousim jine servery na global-$IP.txt... *** " | |
PRESKOC=0 |
PRESKOC=0 | |
Line 31... | Line 32... | |
do |
do | |
if [ $SERVER != $MYIP ]; |
if [ $SERVER != $MYIP ]; | |
then |
then | |
if [ $PRESKOC -lt 1 ]; |
if [ $PRESKOC -lt 1 ]; | |
then |
then | |
if wget -T 3 -t 3 -N http://$SERVER/czf4bfu/global-$IP.txt |
if wget -T 3 -t 3 -N --user-agent='CZF4BFU' http://$SERVER/czf4bfu/global-$IP.txt | |
then |
then | |
echo "*** podarilo se ziskat global-$IP.txt z $SERVER ***" |
echo "*** podarilo se ziskat global-$IP.txt z $SERVER ***" | |
PRESKOC=1 |
PRESKOC=1 | |
fi |
fi | |
fi |
fi | |
fi |
fi | |
done |
done | |
fi |
fi | |
fi |
fi | |
done |
done | |
| ||
# | ||
# zkontrolujeme, jestli neni nejaky global navic | ||
# | ||
ls global-*.txt | sed 's/^global-//' | sed 's/\.txt$//' > temp.list | ||
for TMPSVR in `cat temp.list` | ||
do | ||
OBSAHUJE=$(cat servers.list | grep $TMPSVR | wc -l) | ||
if [ $OBSAHUJE != "0" ] | ||
then | ||
echo "*** $TMPSVR ok ***" | ||
else | ||
if [ $TMPSVR != $MYIP ] | ||
then | ||
echo "*** $TMPSVR NEnalezen v servers.list a smazan ***" | ||
rm ./global-$TMPSVR.txt | ||
fi | ||
fi | ||
done | ||
rm ./temp.list | ||
|
|