Skip to content
Permalink
Browse files

Updated the down.sh script, fixing the same kind of issue as in PR #260

  • Loading branch information...
luccioman committed Dec 10, 2018
1 parent b3d8407 commit 7c7b38cb5a17b652de8202df0fb574d7d2b769a1
Showing with 16 additions and 12 deletions.
  1. +16 −12 bin/down.sh
@@ -1,16 +1,20 @@
#!/usr/bin/env sh
cd "`dirname $0`"
. ./checkDataFolder.sh
. ./checkConfFile.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

port=$(grep ^port= "$YACY_DATA_PATH/SETTINGS/yacy.conf" |cut -d= -f2)
cd "`dirname $0`"

if which curl > /dev/null; then
curl -s "http://localhost:$port/Network.xml?page=2&ip=" | awk '/<address>/{ gsub("<address>","" );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 '/<address>/{ gsub("<address>","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}'
if [ -z "$1" ]; then
# Request the local peer
./apicall.sh "/Network.xml?page=2" | awk '/<address>/{ gsub("<address>","" );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 '/<address>/{ gsub("<address>","" );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 '/<address>/{ gsub("<address>","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}'
else
echo "Please install curl or wget" > /dev/stderr
exit 1
fi
fi

0 comments on commit 7c7b38c

Please sign in to comment.
You can’t perform that action at this time.