From 7c7b38cb5a17b652de8202df0fb574d7d2b769a1 Mon Sep 17 00:00:00 2001 From: luccioman Date: Mon, 10 Dec 2018 18:23:46 +0100 Subject: [PATCH] Updated the down.sh script, fixing the same kind of issue as in PR #260 --- bin/down.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/bin/down.sh b/bin/down.sh index 38134ba31..88d82bbad 100755 --- a/bin/down.sh +++ b/bin/down.sh @@ -1,16 +1,20 @@ #!/usr/bin/env sh +# List the passive senior peers known by the local peer or by the peer at the given address +# $1 : (optional) the peer address as host:port + cd "`dirname $0`" -. ./checkDataFolder.sh -. ./checkConfFile.sh -port=$(grep ^port= "$YACY_DATA_PATH/SETTINGS/yacy.conf" |cut -d= -f2) - -if which curl > /dev/null; then - curl -s "http://localhost:$port/Network.xml?page=2&ip=" | awk '/
/{ gsub("
","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}' -elif which wget > /dev/null; then - wget -q -O - "http://localhost:$port/Network.xml?page=2&ip=" | awk '/
/{ gsub("
","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}' +if [ -z "$1" ]; then + # Request the local peer + ./apicall.sh "/Network.xml?page=2" | awk '/
/{ gsub("
","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}' else - echo "Please install curl or wget" > /dev/stderr - exit 1 -fi - + # Request the given peer + if which curl > /dev/null; then + curl -sSf "http://$1/Network.xml?page=2" | awk '/
/{ gsub("
","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}' + elif which wget > /dev/null; then + wget -nv -t 1 --timeout=120 "http://$1/Network.xml?page=2" -O - | awk '/
/{ gsub("
","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}' + else + echo "Please install curl or wget" > /dev/stderr + exit 1 + fi +fi \ No newline at end of file