cache "$result" > /tmp/zen/current.duniter for 15mn
This commit is contained in:
parent
7f905a45c9
commit
632ca11e8c
|
@ -56,6 +56,10 @@ DIR=/tmp/zen/gnodewatch
|
||||||
export DIR
|
export DIR
|
||||||
mkdir -p $DIR/chains
|
mkdir -p $DIR/chains
|
||||||
|
|
||||||
|
# KEEP /tmp/zen/current.duniter for 15 mn
|
||||||
|
find /tmp/zen/ -cmin +15 -type f -name "current.duniter" -exec rm -f '{}' \;
|
||||||
|
[[ -f /tmp/zen/current.duniter ]] && cat /tmp/zen/current.duniter && exit 0
|
||||||
|
|
||||||
##### $DIR/duniter_nodes.txt REFRESH after 20 minutes #####
|
##### $DIR/duniter_nodes.txt REFRESH after 20 minutes #####
|
||||||
find $DIR/ -cmin +20 -type f -name "duniter_*" -exec rm -f '{}' \;
|
find $DIR/ -cmin +20 -type f -name "duniter_*" -exec rm -f '{}' \;
|
||||||
if [[ ! -f $DIR/duniter_nodes.txt ]]; then
|
if [[ ! -f $DIR/duniter_nodes.txt ]]; then
|
||||||
|
@ -105,4 +109,7 @@ longchain=$(ls -S $DIR/chains/ | head -n 1)
|
||||||
cp $DIR/chains/$longchain $DIR/good.nodes.txt
|
cp $DIR/chains/$longchain $DIR/good.nodes.txt
|
||||||
# WRITE OUT shuffle Duniter Node Sync with longest chain
|
# WRITE OUT shuffle Duniter Node Sync with longest chain
|
||||||
result=$(shuf -n 1 $DIR/good.nodes.txt)
|
result=$(shuf -n 1 $DIR/good.nodes.txt)
|
||||||
[[ ! $result ]] && echo "duniter-g1.p2p.legal:443" || echo $result
|
[[ ! $result ]] && result="duniter-g1.p2p.legal:443"
|
||||||
|
echo "$result" > /tmp/zen/current.duniter
|
||||||
|
|
||||||
|
echo $result
|
||||||
|
|
|
@ -56,6 +56,10 @@ DIR=/tmp/zen/gnodewatch
|
||||||
export DIR
|
export DIR
|
||||||
mkdir -p $DIR/chains
|
mkdir -p $DIR/chains
|
||||||
|
|
||||||
|
# KEEP /tmp/zen/current.duniter for 15 mn
|
||||||
|
find /tmp/zen/ -cmin +15 -type f -name "current.duniter" -exec rm -f '{}' \;
|
||||||
|
[[ -f /tmp/zen/current.duniter ]] && cat /tmp/zen/current.duniter && exit 0
|
||||||
|
|
||||||
##### $DIR/duniter_nodes.txt REFRESH after 20 minutes #####
|
##### $DIR/duniter_nodes.txt REFRESH after 20 minutes #####
|
||||||
find $DIR/ -cmin +20 -type f -name "duniter_*" -exec rm -f '{}' \;
|
find $DIR/ -cmin +20 -type f -name "duniter_*" -exec rm -f '{}' \;
|
||||||
if [[ ! -f $DIR/duniter_nodes.txt ]]; then
|
if [[ ! -f $DIR/duniter_nodes.txt ]]; then
|
||||||
|
@ -105,4 +109,7 @@ longchain=$(ls -S $DIR/chains/ | head -n 1)
|
||||||
cp $DIR/chains/$longchain $DIR/good.nodes.txt
|
cp $DIR/chains/$longchain $DIR/good.nodes.txt
|
||||||
# WRITE OUT shuffle Duniter Node Sync with longest chain
|
# WRITE OUT shuffle Duniter Node Sync with longest chain
|
||||||
result=$(shuf -n 1 $DIR/good.nodes.txt)
|
result=$(shuf -n 1 $DIR/good.nodes.txt)
|
||||||
[[ ! $result ]] && echo "duniter-g1.p2p.legal:443" || echo $result
|
[[ ! $result ]] && result="duniter-g1.p2p.legal:443"
|
||||||
|
echo "$result" > /tmp/zen/current.duniter
|
||||||
|
|
||||||
|
echo $result
|
||||||
|
|
Loading…
Reference in New Issue