diff options
| author | luccioman <luccioman@users.noreply.github.com> | 2018-12-10 17:53:12 +0100 |
|---|---|---|
| committer | luccioman <luccioman@users.noreply.github.com> | 2018-12-10 17:53:12 +0100 |
| commit | b3d8407462cc0fca17ff59f1db920f389e8e8827 (patch) | |
| tree | 6c5baf00d0aa79f2ee60534779810c66d0dfbb50 /bin | |
| parent | 1b3cb3820efc7f1f2ab008ddd80e84fc4ef84091 (diff) | |
Updated up.sh to support passing the target peer address as a parameter
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/up.sh | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -1,7 +1,20 @@ #!/usr/bin/env sh -cd "`dirname $0`" -./apicall.sh "/Network.xml?page=1" | awk '/<address>/{ gsub("<address>","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}'; +# List the active principal and 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) -#./up1.sh localhost:$port +cd "`dirname $0`" +if [ -z "$1" ]; then + # Request the local peer + ./apicall.sh "/Network.xml?page=1" | awk '/<address>/{ gsub("<address>","" );gsub("<\/address>","" ); print $0 }' | awk '{print $1}' +else + # Request the given peer + if which curl > /dev/null; then + curl -sSf "http://$1/Network.xml?page=1" | 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=1" -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
\ No newline at end of file |
